web.xml Visual Editor: Error Pages

See Also 

Use the Error Pages section to add, remove, and view the deployment information of your web application's error pages. An error page is a web component that handles errors.

Web components such as servlets and JSP pages may throw exceptions to indicate error conditions. Usually, a web component catches and handles its own exceptions, as well as exceptions from the other components it uses. When a web component receives or generates an exception that it does not catch, the exception is passed to the web container (part of the J2EE server). If another web component is defined as an error page for that exception, the request is directed to the error page's URL.

To define the web component that handles an error, you can register it in the web.xml file. For example, you can register a JSP file or a Java class as an error page in the web.xml file. When you do this, you must provide information needed by the server for handling an exception. For example, you specify the error code or the exception type that must occur for the error page to be called.

Before you can register an error page in the web.xml file, you must create it or import it from your existing sources. For example, you can use the New File wizard to create a JSP file.

You open the web.xml Visual Editor from the Projects window by expanding the Web Pages node, then the WEB-INF node, and then double-clicking the web.xml file. Click Pages at the top of the editor to open the Pages view. Click the Error Pages header to open the Error Pages section.

Click Add to define the error page element with the following properties:

See Also
About Deployment Descriptors
About Configuring Web Applications
Configuring Web Application Deployment Descriptors

Legal Notices