How do I create a JSP error page to handle exceptions?
Author: Deron Eriksson
Description: This Java tutorial describes how to create a JSP error page to handle exceptions.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 2.0 (Eclipse 3.3.0) || Tomcat 5.5.20


Page: < 1 2

(Continued from page 1)

If we cause our web application to throw a ServletException, we can see that our browser window is sent to the error.jsp page, shown below.

error.jsp page results displayed in web browser

One common technique on error pages is to wrap the stackTrace section of the jspW in HTMLW comments (<!-- and -->) so that the stackTrace isn't normally seen by users, but it can be seen by viewing the page source code.

Page: < 1 2