I need to trap all kinds 500 error on my jsp page. I have tried the <%@ page errorPage="myerror.jsp"> but it only works on selected errors. How can I trap all errors, including syntax errors?

Bozidar Dangubic

You can setup your web application to have error pages associated with a type of exception/error that occurs when pages are executed. You can setup a generic error page for Throwable and then more specific error pages from more specific exceptions/erros that occur. Here is a sample web deployment descriptor that outlines the strategy:

<web-app>
<!-- servlet definitions, resource refs.. -->
<error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/error-pages/generic.htm</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/error-pages/500.htm</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/error-pages/notThere.htm</location>
</error-page>
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact