目前我有一个JSF - Primefaces Web应用程序,其中有多个(10)div容器,显示从Managed Bean获取的特定详细信息。容器将显示加载gif,直到获取信息。检索后,隐藏微调器div并显示信息。
参考下面的Snippet(显示1 Div)
<c:set value="#{cc.attrs.id}_panel" var="asyncPanelID"></c:set>
<h:panelGroup layout="block" class="content" id="#{cc.attrs.id}_panel" >
<h:panelGroup layout="block" rendered="#{cc.attrs.map[asyncPanelID] ne ''}">
<ui:include src="#{cc.attrs.contentFilePath}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{cc.attrs.map[asyncPanelID] eq ''}" style="width:100%">
<p:graphicImage url="/resources/images/Loading_Dots.gif" styleClass="loadingGif"/>
</h:panelGroup>
</h:panelGroup>
<h:commandButton style="display:none" styleClass="#{asyncPanelID}">
<f:setPropertyActionListener target="#{cc.attrs.map[asyncPanelID]}" value="true"></f:setPropertyActionListener>
<p:ajax async="true" update="#{cc.attrs.id}_panel" ></p:ajax>
</h:commandButton>
页面工作正常一段时间,但随着负载的增加,它开始显示微调器,而不是响应。我正在使用Jboss EAP。
对于此类失败方案,Ajax响应如下
<partial-response><changes><update id="javax.faces.ViewState"><![CDATA[7655631808983688760:7124086963450351416]]</update></changes></partial-response>
成功回应
<partial-response><changes><update id="HeaderForm:quoteHeaderPanelTest:quoteHeaderPanelTest_panel"><![CDATA[<div id="HeaderForm:quoteHeaderPanelTest:quoteHeaderPanelTest_panel" class="content">
.
.
.
</update>
</changes>
</partial-response>
更新
删除async =“true”属性似乎有助于解决问题。但影响性能。还有其他方法吗?
更新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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>WebModule</display-name>
<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>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>StreamFile</servlet-name>
<url-pattern>/streamFile</url-pattern>
</servlet-mapping>
<context-param>
<description>Cache Level</description>
<param-name>Cache-Level</param-name>
<param-value>private</param-value>
</context-param>
<context-param>
<description>Pragma level</description>
<param-name>Pragma-Level</param-name>
<param-value>no-cache</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfLogicalViews</param-name>
<param-value>5</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.numberOfViewsInSession</param-name>
<param-value>5</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.sendPoweredByHeader</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<session-config>
<session-timeout>30</session-timeout>
<cookie-config>
<http-only>true</http-only>
<secure>true</secure>
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/login/login.xhtml</location>
</error-page>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>
org.primefaces.webapp.filter.FileUploadFilter
</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>SessionFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</filter-mapping>
<error-page>
<error-code>404</error-code>
<location>/error/error_404.xhtml</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/error_500.xhtml</location>
</error-page>
<welcome-file-list>
<welcome-file>login/login.xhtml</welcome-file>
</welcome-file-list>
</web-app>