When an error occurs during execution of a web application, you can have the application display a specific error screen according to the type of error. In particular, you can specify a mapping between the status code returned in an HTTP response or a Java programming language exception returned by any web component and any type of error screen.
You can have multiple error-page elements in your deployment descriptor. Each element identifies a different error that causes an error page to open. This error page can be the same for any number of error-page elements.
Open the project if you haven’t already.
Expand the project’s node in the Projects pane.
Expand the Web Pages node and then the WEB-INF node.
Double-click web.xml.
Click Pages at the top of the editor pane.
Expand the Error Pages node.
Click Add.
The Add Error Page dialog opens.
Click Browse to locate the page that you want to act as the error page.
In the Error Code field, type the HTTP status code that will cause the error page to be opened.
In the Exception Type field, type the exception that will cause the error page to load.
Click OK.