How to Customize Error pages in Tomcat
by Vinoth[ Edit ] 2009-06-02 18:12:52
Create your customize Error page.
There are two types of error handling
1.Page Level Error handling
2.Application level Error Handling
1.Page Level Error handling
Through this the page has its own default error page when Exception occur. To enable this feature add the bellow line in the page
<%@ page errorPage="/errorHandler.jsp" %>
It just forward from current page to "errorHandlerPage.jsp" . We can Customize our error page our own format.
2.Application Level Error handling
Through this we can customize error pages for the entire application.
To use this feature add bellow code in your web.xml file
< error-page>
<exception-type>Type of Exxception</exception-type>
<location>/errorPage.jsp</location>
</error-page>
OR
< error-page>
<error-code>Eror Code</error-code>
<location>/errorPage.jsp</location>
</error-page>
Example:[404 Page Not Found Exception]
Add the bellow code in WEB-INF/web.xml
<error-page>
<error-code>404</error-code>
<location>/pageNotFound.jsp</location>
</error-page>