We've
done this kind of thing with no problems. I recall there was a discussion,
perhaps on the Sun JSF forums, concerning a bug with some combination of JSF
implementation and application server where the exceptions were being wrapped in
ServletExceptions (or something) and then not being interpreted properly by the
container for the error page mechanism.
Hi,
I'm using JSF with Facelets and I'm trying to use standard error pages but
they doesn't seem to work with facelets, only in normal JSP pages. Is this
combination valid? if not, how facelets is supposed to handle error pages ?
Any idea is welcome.
Here is my web.xml:
Code:
<error-page>
<exception-type>javax.faces.el.EvaluationException</exception-type>
<location>/AppError.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/AppError.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/AppError.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/AppError.jsp</location>
</error-page>
And my facelet page:
Code:
It
calls a authorizationBean.doSomethingNull method that explicitly forces a
NUllpointerException to be thrown.
AppError.jsp is a plain JSP
page:
Code:
<%@ page isErrorPage="true" %>
<HTML>
<HEAD>
<TITLE>Error Information</TITLE>
</HEAD>
<BODY>
An error occurred during processing!<br><br>
</BODY>
</HTML>
And the
exception displayed on the App Server console and not properly handled by
the Error page is :
[1/19/09 15:26:26:681 CST] 00000028
jsf E
com.sun.faces.lifecycle.InvokeApplicationPhase execute /index.jspx @20,116
actionListener="#{authorizationBean.doSomethingNull}":
java.lang.NullPointerException: Just a
test...
javax.faces.el.EvaluationException: /index.jspx @20,116
actionListener="#{authorizationBean.doSomethingNull}":
java.lang.NullPointerException: Just a test...
at
com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
at
javax.faces.component.UICommand.broadcast(UICommand.java:305)
at
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:419)
at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
Mario
Rodriguez