Knowledgebase
Custom Error Pages
Posted by on 08 July 2017 07:37 AM


<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>
&lt;error-page&gt;
&lt;error-code&gt;500&lt;/error-code&gt;
&lt;location&gt;/server500error.html&lt;/location&gt;
&lt;/error-page&gt;
&lt;error-page&gt;
&lt;error-code&gt;404&lt;/error-code&gt;
&lt;location&gt;/file_not_found404.html&lt;/location&gt;
&lt;/error-page&gt;
</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>

(1 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: