# web.xml Visual Editor: Error Pages

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. In the Visual Editor, click Pages at the top of the editor to open the Pages view. Click the Error Pages header to open the Error Pages section.

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.

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

Element | Description
--- | ---
Error Page Location | Specifies the location of the error page.
Error Code | Specifies the HTTP error code that invokes the error page, such as `404`. See the link below for a complete list of HTTP error codes and their descriptions.
Exception Type | Specifies the Java exception type that invokes the error page, such as `java.lang.NullPointerException`.

Related Topics

Developing Applications with NetBeans IDE,

Developing Applications with NetBeans IDE,

Copyright © 2016, Oracle and/or its affiliates. All rights reserved.