Hi
I want to see what people think about a possible enhancement of error
handling feature of myfaces, thanks to a suggestion of Martin.
For this purpose, I create a issue on jira ( MYFACES-1889).
The summary of this feature is this:
One possible enhancement to the error handling feature of myfaces could be
the capability of redirect to a jsf page.
I have studied the issue in deep and the thing could be as described below:
1. Add this configuration to WEB-INF/web.xml
<context-param>
<description>
Handle exceptions with jsf redirect page.
</description>
<param-name>org.apache.myfaces.ERROR_HANDLING_REDIRECT_PAGE</param-name>
<param-value>true</param-value>
</context-param>
2. Define a navigation rule like this:
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>java.lang.NullPointerException</from-outcome>
<to-view-id>/nullErrorPage.jsp</to-view-id>
</navigation-case>
</navigation-rule>
Note that in from-outcome there is defined the class name of the error to be
redirected by this page.
The first test of this feature has been successful, but there are some
questions to be solved:
1. How to add error information to be displayed (maybe add as a value on the
request scope like exceptionList)
2. How to handle multiple errors, maybe the best is use a special outcome
like org.apache.myfaces.MultipleThrowable
I'll do some test this weekend and add a possible patch of this feature.
Suggestions are welcome.
regards
Leonardo Uribe