Java JSF - Redirect to an XHTML site when a ViewExpiredException occurs

Revision as of 22:34, 1 August 2020 by Ardaut (talk | changes) (Created page with " 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.