up previous next contents
Next: Survey of other server-side Up: JavaServer Pages Previous: Implicit objects   Contents

Exception handling

  • If a JSP causes an exception to be thrown, good practices dictate that the exception is handled by code, or that the user be forwarded to an error page.
  • Exceptions can be caught in scriptlets.
  • Use the <%@ page errorPage="/error.jsp" %> directive to define an error page.
  • Identify the error page with the page directive, <%@ page isErrorPage="true" %>.
  • The JSP container makes the implicit exception object available to a defined error page.


up previous next contents
Next: Survey of other server-side Up: JavaServer Pages Previous: Implicit objects   Contents