0

In my web project, most of the pages are using View Scoped managed beans. It's working great, but sometimes, i notice that if i get away from the page for a time, like, 10 minutes, when i return back to the page, everything in the page stops working, and no console errors are shown in the server. I think this is due to the life of a view, but have found nothing about it. Where can i find info about it? Is there a way to configure the life time of a view?

I'm using apache tomcat 7. Below is my web.xml configuration file:

<?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>

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mateus Viccari
  • 7,389
  • 14
  • 65
  • 101

1 Answers1

1

You should see it if you have paid attention to the HTTP response of the ajax request in browser's developer toolset (press F12 in Chrome/Firebug/IE9):

enter image description here

Indeed, the session has expired. An elaborate explanation about why this is a problem for JSF can be found in this answer: javax.faces.application.ViewExpiredException: View could not be restored.

JSF ajax requests have by default no form of feedback in case of exceptions. How to fix this is already answered here: Session timeout and ViewExpiredException handling on JSF/PrimeFaces ajax request.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • but there is no life time configuration? what if a want to let the pages alive for more time before losing the session? – Mateus Viccari May 21 '13 at 17:53
  • It's just the standard Servlet API session timeout config in `web.xml`. See also among others http://stackoverflow.com/questions/7449468/default-session-expiration-timeout/7449488#7449488. This is further not related to JSF. – BalusC May 21 '13 at 17:54