I am trying to have the following error pages in my web.xml :
I make a "mistake" in the jsp page and a ClassCastException is thrown. The 2 error pages have "isErrorPage" True. The problem is that I don't see the error.jsp file but the mainError.jsp file. If I print the exception in the jsp file he says it's of type java.lang.ClassCastException. Changing the order of the error-pages doesn't seem to help. If I delete the Throwable I get the correct page.
Can anybody tell me what the spec says about this? Should the Throwable be displayed or the more specific exception? Also does the order of the error-pages matter?
I have looked on the web and here for a while but I can't find it at all. (I am studying for the 1Z0-858 exam)
The Web application may have declared error pages using the exception type element. In this case the container matches the exception type by comparing the exception thrown with the list of error-page definitions that use the exception-type element. A match results in the container returning the resource indicated in the location entry. The closest match in the class hierarchy wins.
So according to the specs you should be redirected to the "/error.jsp"