I am using JSF with RichFacecs to create a web portal .I want to redirect the user to the login page on session time out. I was trying to throw a SecurityException in session expiry/logged out stage as follows
<error-page>
<exception-type>java.lang.SecurityException</exception-type>
<location>/Login.jsf</location>
</error-page>
But this is not working for me. Which is the right way of handling this ?
This should do it :
I had some problems when I making A4J requests after session expiration. I put this
in my web.xml, for me it solves the problem.
Another solution is to create CustomViewHandler that extends ViewHandler and override restoreView method
Then you need to add it to your faces-config.xml
This will prevent you from getting ViewExpiredException's
you should put a timeout in your web.xml and register a timeout filter as shown in this thread: Auto-logout in JSF Application in case of ajax, your redirection has to be done like that:
The solution is to use Richfaces own
session expired event
.Add this to the page prone to expire:
More info can be found at the RichFaces documentation: http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/ArchitectureOverview.html#SessionExpiredHandling