Difference between revisions of "Java JSF - Redirect to an XHTML site when a ViewExpiredException occurs"

(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...")
 
(No difference)

Latest revision as of 23:34, 1 August 2020

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.