Redirecting on session timeout in JSF-Richfaces-facelet

Jinesh picture Jinesh · Sep 17, 2009 · Viewed 22.7k times · Source

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 ?

Answer

Chris Dale picture Chris Dale · Sep 17, 2009

This should do it :

<error-page>
    <exception-type>javax.faces.application.ViewExpiredException</exception-type>
    <location>/sessionExpired.jsf</location>
</error-page>