<p> You can define your own custom error pages in your <b>web.xml</b> file. In the example shown below, we define 2 web pages -- <b>server500error.html</b> and <b>file_not_found404.html</b> -- which will be displayed when the server encounters an error 500 or an error 404 respectively. </p>
<table cellspacing="1" cellpadding="4" bgcolor="#6299c5"> <tr> <td bgcolor="#ffffff"> <pre> <error-page> <error-code>500</error-code> <location>/server500error.html</location> </error-page> <error-page> <error-code>404</error-code> <location>/file_not_found404.html</location> </error-page> </pre> </td> </tr> </table>
<p> You should bear in mind, however, that the order of the tags for the <b>web.xml</b> file is very important. If the order in your web.xml file is incorrect, Tomcat will output errors on startup. </p>
|