4

Error Page Handling In JSP

The error-page element declares a mapping between an error and a resource in the Web application that is called when that error occurs. Ther errors can be caused by HTTP errors (such as 404 Not Found) and Web application exceptions (like a ServletException). The errors can be mapped to any vali resource in the Web application, so it may be handled by a static HTML page, a JSP page, or a sevlet.

In web deployment descriptor put following

<web-app>
<error-page>
<error-code>404</error-code&gt
<location>/file-not-found.html<location>
</error-page>

<error-page>
<error-code>javax.servlet.ServletException</error-code&gt
<location>/oopsy.jsp<location>
</error-page>

.. while using action

<error-page>
<error-code>404</error-code&gt
<location>/showError.do<location>
</error-page>
</web-app>


|

Copyright © 2009 So That I Can Remember All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.