Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error code mappings in web.xml not working

I have created a simple web application, for which I want all responses with 404 status code to be redirected to an error page within my web-app.

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 back a 404 status code (using HttpServletResponse.sendError()). However, I still get shown a 404 Not Found page (instead of my error page).

Any ideas why this could be happening ?

like image 901
divesh premdeep Avatar asked Jan 23 '23 19:01

divesh premdeep


1 Answers

is this in IE? sometimes the browser needs a minimum amount of content in the response, otherwise it displays its own default message. IE needs 512 bytes at minimum, which could be supplied with some padding or whatever. More nfoz:

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

like image 74
jspcal Avatar answered Feb 19 '23 12:02

jspcal