11.10. The isErrorPage Attribute

The isErrorPage attribute indicates whether or not the current page can act as the error page for another JSP page. Use of isErrorPage takes one of the following two forms:

<%@ page isErrorPage="true" %>
<%@ page isErrorPage="false" %> <%!-- Default --%>

For example, Listing 11.5 shows a JSP page to compute speed based upon distance and time parameters. The page neglects to check if the input parameters are missing or malformed, so an error could easily occur at run time. However, the page designated SpeedErrors.jsp (Listing 11.6) as the page to handle errors that occur in ComputeSpeed.jsp, so the user does not receive the typical terse JSP error messages. Figures 11-9 and 11-10 show results when good and bad ...

Get Core Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.