myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: [JSF][CORE] No View State Exception
Date Tue, 17 Feb 2009 09:11:22 GMT
Guy Bashan schrieb:
> I am having a weird issue with JSF: I set the session expiration in my
> application to 1 minute (for testing purposes). I load the web
> application. the entrance page is a simple login page with 2 fields
> (username/password). I wait for 1 minute for session to expire. I try to
> login. I get this exception:
> 
> 
> 2009-02-17 10:48:33,522 [http-8080-2] ERROR
> org.ajax4jsf.webapp.BaseXMLFilter  - Exception in the filter chain
> 
> javax.servlet.ServletException: /login.jspxNo saved view state could be
> found for the view identifier: /login.jspx
> <
> Caused by: javax.faces.application.ViewExpiredException: /login.jspxNo
> saved view state could be found for the view identifier: /login.jspx
> 
>       at
> org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:88)
> 
> 
> Why am I getting it? this is really annoying...

This is expected. Your page submit is including the id of a server-side
view state that no longer exists - what should the server do in this
case? No "postback" processing can occur when the view cannot be
restored, as there are no JSF input or command components to look for
data in the submitted form.

You can use the <error-page> element in the web.xml to cause a redirect
to the login page (or some other page). The original url and thrown
exception (and its causes) are available as request-scoped objects I think.

Or use a filter to catch the ViewExpiredException and do whatever you
want in this case.

Or put some javascript in the login page that "pings" the server every
few minutes, so the session does not expire.

Or avoid using JSF for the login page. You'll still have this issue on
other pages, but it is more understandable to the user that they have
"timed out" on some page in the middle of the app rather than having
"timed out" in the login page.

Regards,
Simon
-- 
-- Emails in "mixed" posting style will be ignored
-- (http://en.wikipedia.org/wiki/Posting_style)

Mime
View raw message