5.8. Designating Pages to Handle Errors

Now, I realize that you never make any mistakes when developing servlets and JSP pages and that all of your pages are so clear that no rational person could be confused by them. Still, however, the world is full of irrational people, and users could supply illegal parameters, use incorrect URLs, or fail to provide values for required form fields. Besides, other developers might not be as careful as you are, and they should have some tools to overcome their deficiencies.

The error-page element is used to handle problems. It has two possible subelements: error-code and exception-type. The first of these, error-code, designates what URL to use when a designated HTTP error code occurs. (If you aren’t familiar ...

Get More 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.