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.