| Author |
error-page element in web.xml
|
Aaron John
Ranch Hand
Joined: May 30, 2005
Posts: 74
|
|
I have a question regarding this <error-page> element. I read that you can specify either an <error-code> or <exception-type> inside an <error-page>, but not both under the same <error-page> element. Suppose I have three <error-page> elements in my web.xml, like below: <error-page> <error-code>500</error-code> <location>/jsp/error.jsp</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/jsp/error.jsp</location> </error-page> <error-page> <exception-type>NoPermissionException</exception-type> <location>/jsp/NoPermissionException.jsp</location> </error-page> How does it know to redirect to the specified JSP if NoPermissionException is a subclass of Throwable? Also if a NoPermissionException is thrown, the HTTP code is 500, so how does it know to go to NoPermissionException.jsp instead of error.jsp as specified in <error-code>? Please explain this to me. Thank you.
|
 |
Aaron John
Ranch Hand
Joined: May 30, 2005
Posts: 74
|
|
|
Looks like my post was posted 4 times. Please ignore the rest
|
 |
dema rogatkin
Ranch Hand
Joined: Oct 09, 2002
Posts: 294
|
|
Spec states something like: 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 exceptiontype element. A match results in the container returning the resource indicated in the location entry. The closest match in the class heirarchy wins.
|
Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
|
 |
 |
|
|
subject: error-page element in web.xml
|
|
|