Error code mapping in web.xml does not work

I created a simple web application for which I want all responses with a 404 status code to be redirected to the error page in my web application.

I have included the following entry in my web.xml file.

<error-page> <error-code>404</error-code> <location>/error.html</location> </error-page> 

In my main servlet, I send a 404 status code (using HttpServletResponse.sendError ()). However, I still see the 404 Not Found page (instead of my error page).

Any ideas why this could be happening?

+4
source share
1 answer

is it in IE? sometimes the browser requires a minimal amount of content in the response, otherwise it displays its own message by default. IE must have a minimum of 512 bytes, which can be provided with some addition or any other. More nfoz:

http://www.404-error-page.com/404-error-page-too-short-problem-microsoft-ie.shtml

+9
source

All Articles