Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Developer's Guide

- Previous: Configuring Logging in the Web Container
- Next: Header Management

## Configuring HTML Error Pages

To specify an error page (or URL to an error page) to be displayed to the end user, use the `error-url` attribute of the sun-web-app element in the `sun-web.xml` file. For example:

    <sun-web-app error-url="webserver-install-dir/error/error1.html">
    ... subelements ...
    </sun-web-app>

For details, see sun-web-app.

If the `error-url` attribute is specified, it overrides all other mechanisms configured for error reporting.

Note –

This attribute should not point to a URL on the Application Server instance, because the `error-url` cannot be loaded if the server is down. Instead, specify a URL that points to a location on the web server.

The Application Server provides the following options for specifying the error page.

- You can specify the `error-url` to be an HTTP URL. The Application Server forwards the client request to the specified error URL.

- If you do not specify the `error-url` attribute in the `sun-web.xml` file, a default error page is displayed.

The error page is displayed according to the following rules:

- When an error is encountered for an application, the Application Server first checks if the `error-url` attribute is defined. If it is defined, the Application Server reads the URL attribute and loads the error page.

- If the `error-url` attribute is missing or invalid, the Application Server displays the default error page.

- If the `error-url` has been defined but the page is missing, the Application Server loads the default error page.

- If the default error page is missing, the error is forwarded to the web server.

- Previous: Configuring Logging in the Web Container
- Next: Header Management

- © 2010, Oracle Corporation and/or its affiliates