How to configure custom error page in a JSF portlet
-
26-06-2021 - |
Question
I have a JSF Portlet in a Portal page. I need to display a error page whenever an exception is thrown by any of the page bean methods. How can I do that?
I tried the below configuration in web.xml and it works for a servlet but not for a portlet.
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/faces/exception.xhtml</location>
</error-page>
Right now whenever a page bean method throws exception, the application displays the first page.
I am using JSF 1.2 + Facelets and I don't have any additional 3rd party libraries.
Solution
I extended the IBM FacesPortlet which we were using and added exception handling in processAction and render methods.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow