M
may
Hi
JSP pages can define <%page errorPage="/anyerror.jsp" %> to direct
browser to anyerror.jsp page in case of unexpected error in the JSP
page.
There is also <error-page> tag that can be defined in web.xml
deployment descriptor for declaring error pages based on exception
types declared.
e.g.
<error-page>
<error-code>404</error-code>
<location>/jsp/error/PageNotFound.jsp</location>
</error-page>
<error-page>
<exception-type>java.rmi.RemoteException</exception-type>
<location>/jsp/error/ErrorPage.jsp</location>
</error-page>
I have seen that if error (e.g. Remote exception is thrown) occurs in
the JSP page, browser always redirect to anyerror.jsp and there is no
effect of what is declared in web.xml (even when a matching exception
is in the deployment descritpor). Is this correct behaviour? Please
can someone throw light on usage of these two alternatives.
Many thanks in advance for your reply
Regards
JSP pages can define <%page errorPage="/anyerror.jsp" %> to direct
browser to anyerror.jsp page in case of unexpected error in the JSP
page.
There is also <error-page> tag that can be defined in web.xml
deployment descriptor for declaring error pages based on exception
types declared.
e.g.
<error-page>
<error-code>404</error-code>
<location>/jsp/error/PageNotFound.jsp</location>
</error-page>
<error-page>
<exception-type>java.rmi.RemoteException</exception-type>
<location>/jsp/error/ErrorPage.jsp</location>
</error-page>
I have seen that if error (e.g. Remote exception is thrown) occurs in
the JSP page, browser always redirect to anyerror.jsp and there is no
effect of what is declared in web.xml (even when a matching exception
is in the deployment descritpor). Is this correct behaviour? Please
can someone throw light on usage of these two alternatives.
Many thanks in advance for your reply
Regards