Error pages for JavaServer Pages  Saving Java source code

Chapter 4: Exception Handling

Uncaught exceptions

You can handle any exceptions that are thrown from the body of the implementation class and are not caught by using an error page that you specify using a page directive. Both the client request and the uncaught exception are forwarded to the error page.

To specify an error page for a JSP, set its errorPage attribute to the URL of the error page in a page directive:

<%@ page errorPage="ErrorPage.jsp" %> 

The java.lang.Throwable exception is stored in the javax.ServletRequest instance for the client request using the putAttribute method, using the name javax.servlet.jsp.jspException.





Copyright © 2005. Sybase Inc. All rights reserved. Saving Java source code

View this book as PDF