• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple error-pages in web.xml

 
Tim Boeckstaens
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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)

Thanks in advance
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2404
93
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

This is what the specs say about it:
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"

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic