Sunday, August 6, 2017

J2EE: custom error page


If a custom error page for a specific HTTP error is needed:

1. Add the error page configuration in the web application's WEB-INF/web.xml:
     <error-page>
        <error-code>404</error-code>
        <location>/error404.html</location>
    </error-page>


2. Create a error404.html at the web application's root directory.

If such configuration is not set in the web application but somehow the 404 error can still trigger a custom error page, that may be because the administrator has done it for you in the Tomcat's conf/web.xml.


No comments:

 
Get This <