关于观看持续时间/生命时间的一些问题

时间:2013-05-21 16:54:53

标签: jsf-2

在我的Web项目中,大多数页面都使用View Scoped托管bean。 它工作得很好,但有时,我注意到如果我离开页面一段时间,比如10分钟,当我返回页面时,页面中的所有内容都停止工作,并且服务器中没有显示控制台错误。 我认为这是由于视图的生命,但没有发现它。 我在哪里可以找到有关它的信息? 有没有办法配置视图的生命周期?

我正在使用apache tomcat 7。 下面是我的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>AtualyGestao</display-name>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    <welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<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>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>home</param-value>
</context-param>

1 个答案:

答案 0 :(得分:1)

如果你在浏览器的开发者工具集中注意了ajax请求的HTTP响应,你应该看到它(按Chrome / Firebug / IE9中的F12):

enter image description here

确实,会议已经过期。有关为什么这是JSF问题的详细解释可以在这个答案中找到:javax.faces.application.ViewExpiredException: View could not be restored

默认情况下,JSF ajax请求没有任何形式的反馈。如何解决这个问题已在这里得到解答:Session timeout and ViewExpiredException handling on JSF/PrimeFaces ajax request

相关问题