Make your own error pages

The guy surfing your site doesn’t want to see your stack trace. And he’s not too thrilled to get a standard “404 Not Found”, either.

You can’t prevent all errors, of course, but you can at least give the user a friendlier (and more attractive) error response page. You can design a custom page to handle errors, then use the page directive to configure it.

The designated ERROR page (“errorPage.jsp”)

image with no caption

The BAD page that throws an exception (“badPage.jsp”)

image with no caption

What happens when you request “badPage.jsp”

image with no caption

She doesn’t know about the <error-page> DD tag.

image with no caption

You can declare error pages in the DD for the entire web app, and you can even configure different error pages for different exception types, or HTTP error code types (404, 500, etc.).

The Container uses <error-page> configuration in the DD as the default, but if a JSP has an explicit errorPage page directive, the Container uses the directive.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset