I want to send the user to one error page whenever an error occurs, whether it be a 404, 500..etc. I was using the error-code in the web.xml but I want to trap all instances of java.lang.Throwable since I believe any error is a subclass of java.lang.Throwable. Also, when I used the error-code scheme, the stacktraces were not appearing in Tomcat’s catlina.out anymore…any ideas? I wasn’t sure if JSF2’s ExceptionHandler API handled 404s?
<error-page>
<error-code>404</error-code>
<location>/pageNotFound.html</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/systemError.html</location>
</error-page>
This is not the standard behaviour. Your problem is caused by something else. Perhaps it’s the wrong testing methodology or perhaps you’re suppressing exceptions and manually redirecting in some
Filteror like. This is impossible to answer based on the as far provided information.Depends. If the request URL matches the
FacesServlet, then it would by default throw aFileNotFoundExceptionwhich eventually ends up as HTTP 500. If the request URL does not match theFacesServletor any other servlet, then the servlet container will handle it as HTTP 404.