Java JSF - Redirect to an XHTML site when a ViewExpiredException occurs
If you want to redirect the user to a certain site of your JSF web app, then use the tag "error-page" in your "web.xml" file. Here an example where we redirect a user to the index.xhtml site, when a "ViewExpiredException" happens.
<error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/faces/index.xhtml</location> </error-page>
The user will not see an exception in his web browser. You can also use other exceptions as well.