You can set original error page in the web.xml of an application.
If the 404 error (the specified page doesn't exist) occurs, redirect the response to error.html.
e.g.
<error-page>
<error-code>404</error-code>
<location>/error.html</location>
</error-page>
You can use exception-type as well as error-code.
e.g.
<exception-type>java.io.IOException</exception-type>