This is a container tag used to define a custom error page.

Multiple custom error pages can be defined per application.

Tomcat will check your web.xml for these elements before displaying it's default error page.

Error page handlers can be defined according to HTTP error code (eg: 404 errors) or Java Exception type. See <error-code> and <exception-type> for information on how to specify each of these.

Example Uses:

  • Display a branded error page if your application crashes, for a more professional look.
  • Send the details of any crash to the website administrator by email, to be notified early of any problems with your site, rather than waiting for customers to report them.


  • If defining a global error handler, it is important to include an <exception-type> handler to catch java.lang.Throwable exceptions, even if you specify handlers for error codes 500 and 503. This is because the detail of the error will be lower for 500/503. For example, you may be able to detect a ServletException, but not the NumberFormatException that really caused the error.

See Also:

metawerx specific

referring pages