Click here to subscribe to this blog using RSS:
How to customize the Tomcat 404 error pageAdd the following code before the Conf/web.xml final </web-app> in the Tomcat installation directory:
< Error-page >
< Error-code > 404 </error-code >
< location >/errorpage404.jsp </location >
</error-page >
FAQ and Solution:
404 error page This problem, I defined the following definition in Web.xml,
< Error-page >
< Error-code > 404 </error-code >
< location >/error_404.htm </location >
</error-page >
The path is right, it is strange that I entered a nonexistent page in the test, and the 404 error prompted that it was not the page I defined, which is odd. I remember the same definition in WebLogic, so the first thing I thought of was a server problem. Just this kind of problem, do not analyze, I try to send a post in Javaworld, ask a bit. Search on Google, only to find that a lot of people have been this problem. This is the actual problem, if always follow the textbook, should not think of these problems, but the actual operation of their own only to discover these.
Through all the posts, this problem, there are mainly the following factors:
1. Use Tomcat server
2.tomcat Server version
3. Browser problem
setting of 4.IE
5. The size of the error page itself
1th, I think my experience should be a proof.
2nd, many people use tomcat5.5 to find the wrong page smoothly.
3rd, a change of FF, you can successfully find the specified error page
4th, I set the tool-->internet option--> advanced---> Display HTTP friendly error messages (deselect) and can be directed to the specified error page.
Description can
5th, I tried to fahen lost a lot of things in, the specified error page appeared smoothly.
The following are the solutions provided:
1. Upgrade Tomcat (replace with other servers, heavy cost)
2.ie Set Tool-->internet option--> advanced---> Display HTTP friendly error messages (deselect)
3. Make the error page bigger, a few bytes, no test, estimated three hundred or four hundred enough, (plus a div block, display set to none on it)
4. Set the specified error page page state to be correct, cheat IE custom error page method
<%
Response.setstatus (200); = Httpservletresponse.sc_ok
%>
<script type= "Text/javascript" src= "Http://www.google.com/reader/ui/publisher.js" ></script> < Script type= "Text/javascript" src= "http://www.google.com/reader/public/javascript/user/00697638153916680411/ State/com.google/broadcast?n=5&callback=grc_p (%7bc%3a%22green%22%2ct%3a%22%5cu8fd9%5cu4e9b%5cu6587%5cu7ae0 %5cu4e5f%5cu503c%5cu5f97%5cu4e00%5cu770b%22%2cs%3a%22false%22%7d)%3BNEW%20GRC "></script>