我有一个开发的网页,有超过1100行代码,使用JSF 2.0.该页面还包含许多PrimeFaces组件.我也使用JQuery来显示和消失组件.
该网页在Firefox 4.0和3.16浏览器中响应.但是,当我在具有Firefox 3.05b的服务器中部署该站点时,在该页面中执行涉及Ajax的某些操作之后,所述网页似乎缓慢且无响应.甚至页面也无法快速滚动.
造成这种迟缓的原因是什么?是与浏览器的JavaScript处理引擎相关的东西吗?需要一些建议来克服这个冻结的页面.谢谢.
更新:
我有一个init()函数,它返回填充数据表所需的Domaines列表,这个数据表的每一行都有两个命令链接,一个用于编辑,另一个用于删除,所以当我按下编辑命令链接时,一个对话框窗口显示Domaine有可能编辑的信息(还有另一个用于添加新域的对话框),所以问题是当我按下编辑时,调用init函数8次然后设置添加对话框的属性(即使之间没有关系)再次调用init函数4次后,编辑命令链接和添加对话框窗口.我不明白wh.这里是我的页面代码:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<ui:composition template="gpsiTemplate.xhtml">
<ui:define name="left-menu">
<ui:include src="admin-menuGauche.xhtml" />
</ui:define>
<ui:define name="top">
<ui:include src="menu-top.xhtml" />
</ui:define>
<ui:define name="content-top">
<center>
<f:view>
<h:form id="topacteurs">
<h:panelGrid columns="14" styleClass="adminTopTable" >
<h5 class="calendar">Direction :</h5>
<p:selectOneMenu id="typeacteurs" value="#{domaine.choixDirection}" style="width: 180px">
<f:selectItem itemLabel="Direction..." itemValue="" />
<f:selectItems value="#{direction.initcomb()}" var="ta" itemValue="#{ta.codeDirection}" itemLabel="#{ta.libelleDirection}" />
<p:ajax update=":mainform:domainlist" process="topacteurs" event="change" />
</p:selectOneMenu>
<p:spacer width="20" height="0" />
<p:commandButton title="Ajouter un domaine" …Run Code Online (Sandbox Code Playgroud) 我想隐藏dataTable中的一些列(例如id,serial),将呈现列,因为javascript需要访问列的值.任何的想法?
我有这张桌子:
<p:dataTable value="#{requestBean.requestsList}" var="requestClass" style="width:50px;" id="requestList">
<p:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{requestClass.requestID}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Status" />
</f:facet>
<h:outputText value="#{requestClass.requestStatus}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Details" />
</f:facet>
<h:outputText value="#{requestClass.requestTitle}" />
</p:column>
</p:dataTable>
Run Code Online (Sandbox Code Playgroud)
现在行正确显示数据,但我希望能够单击记录ID.当我这样做时,我会转到另一个页面,例如review.xhtmlurl参数将是该ID.所以这样的事情:review.xhtml?id="clicked request".怎么做的?
更新:我试过这个并且它确实有点工作,但它在实践中是否正确?
<p:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<a href="review.xhtml?id=#{requestClass.requestID}">
<h:outputText value="#{requestClass.requestID}" />
</a>
</p:column>
Run Code Online (Sandbox Code Playgroud) 我不能似乎能当我内触发事件column的dataTable.这是我简单的演示
<h:form id="form">
<!--This section of p:tree here seems to be the reason causing the event not fired when click the command button-->
<p:tree value="#{viewBean.root}" var="node" dynamic="true" cache="false"
selectionMode="checkbox" selection="#{treeBean.selectedNode}">
<p:ajax event="expand" update=":form:messages" listener="#{viewBean.onNodeExpand}" />
<p:ajax event="collapse" update=":form:messages" listener="#{viewBean.onNodeCollapse}" />
<p:ajax event="select" update=":form:messages" listener="#{viewBean.onNodeSelect}" />
<p:ajax event="unselect" update=":form:messages" listener="#{viewBean.onNodeUnselect}" />
<p:treeNode>
<h:outputText value="#{node}" />
</p:treeNode>
</p:tree>
<h:panelGroup id="mygroup">
<p:dataTable id="mytable" value="#{viewBean.foodList}" var="item">
<p:column>
#{item}
</p:column>
<p:column>
<p:commandButton value="delete"
action="#{viewBean.delete}"
update=":form:mygroup">
<f:setPropertyActionListener target="#{viewBean.selectedFood}"
value="#{item}"/>
</p:commandButton>
</p:column>
</p:dataTable> …Run Code Online (Sandbox Code Playgroud) 有没有办法设置Firefox和Chrome在h:outputText标记中使用escape = false属性.当某些html需要在浏览器中显示时,Firefox和Chrome会正确显示已解析的字符串,但应用程序中的任何其他链接都会被冻结(??).
来自db的示例html:
<HEAD>
<BASE href="http://"><META content="text/html; charset=utf-8" http-equiv=Content-Type>
<LINK rel=stylesheet type=text/css href=""><META name=GENERATOR content="MSHTML 9.00.8112.16434">
</HEAD>
<BODY><FONT color=#000000 size=2 face="Segoe UI">läuft nicht</FONT></BODY>
Run Code Online (Sandbox Code Playgroud)
在页面上解析HTML:
läuftnicht
非常奇怪的是,在IE中一切正常(通常是相反的).
我使用primefaces组件(v2.2),. xhtml,tomcat 7和JSF 2.0
我遇到了一个问题,即操作完成后我的页面没有刷新.
我在页面上有这个表格:
<h:form id="fundingResults">
<p:ajaxStatus style="width:16px;height:16px;">
<f:facet name="start">
<p:graphicImage value="/images/loading4.gif" />
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
<p:dataTable>
// some form elements in the table
</p:dataTable>
<p:commandButton id="btnEdit" value="Submit" type="submit" action="#{fundingBacker.classifyProducts}" style="float: right;margin-top:15px;" />
</h:form>
Run Code Online (Sandbox Code Playgroud)
我的classifyProducts方法框架是这样的:
public void classifyProducts() {
// a bunch of stuff goes on in here
}
Run Code Online (Sandbox Code Playgroud)
由于隐式导航,classifyProducts()方法完成后页面是否应该自动刷新?
我正在尝试制作一个简单的PrimeFaces示例,例如他们网站上的教程.我基本上和这个用户有完全相同的问题,但我没有像他那样的空jar文件.h:标签渲染正常,但p:标签在HTML中显示为p:标签.PrimeFaces 3.1.1和3.2也存在同样的问题.这是我的web.xml文件.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>jsf</display-name>
<welcome-file-list>
<welcome-file>Login.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<description></description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description></description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description></description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener- class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
我的XHTML文件看起来像这样.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head> …Run Code Online (Sandbox Code Playgroud) 我有一个ui:重复一遍.我希望它每5秒刷新一次.我试过p:民意调查,但它不起作用.有没有办法使这个工作?
<ui:repeat value="#{videoImpl.fGetAllComments()}" var="v" id="commentlist">
<div class="comment-entry"><h:outputText value="#{v.comment}"/></div>
</ui:repeat>
<p:poll update="commentlist" interval="5" />
Run Code Online (Sandbox Code Playgroud) 我正在使用spring webflow和primefaces开发一个应用程序并使用mysql.问题是当我注册日期时,例如15.may.它在数据库中注册正确,但是当我显示它时.它显示在2012年1月14日前一天.我使用此标签显示日期,我相信在显示的日期添加1天.我评论的另一件事是,当我调试时,我看到时间显示如此星期三09月00 00:00:00 CEST.我认为这是在中欧夏季时区.我想知道问题是什么?
<p:column headerText="Submited Date">
<h:outputText value="#{item.submitedDate}">
<f:convertDateTime pattern="dd-MMM-yyyy" ></f:convertDateTime>
</h:outputText>
</p:column>
Run Code Online (Sandbox Code Playgroud)