Error pages for Web applications

When the servlet engine detects an error or catches an exception thrown by a servlet, it searches for a corresponding error page to handle the response. You can specify HTML files to send in response to HTTP error codes and to Java exceptions thrown in JSPs or servlets.

This example illustrates how to declare an error page for a Web application in the deployment descriptor:

<error-page>
  <error-code>404</error-code>
  <location>/etc/404.html</location>
</error-page>

The location is the path relative to the Web application’s context root. For example, /etc/404.html corresponds to this file in your EAServer installation directory, where web-app is the name of the Web application:

deploy/webapps/web-app/etc/404.html