I
I
Ivan R2015-04-09 23:51:13
Java
Ivan R, 2015-04-09 23:51:13

Blank page when handling server errors?

There is REST in: Java, Maven, TomCat, MySql, Hibernate. Now I'm doing server error handling 404, 400, etc. In web.xml file added:

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

But when these errors occur, a blank page appears in my browser. I work in NetBeans, and if I force open a file (/400error.html) like this file:///D:/path to the application /src/main/webapp/400error.html then it is displayed normally if I execute it via http ://localhost:8080/ project name/400error.html , I get a blank page. How to solve this problem

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2015-04-15
@neo55

Try to specify the full path to the file on the server, for example: /WEB-INF/views/404.html (or wherever you have it there)
Also, look, you are not mapping the application to the root, but in /application_name you can also try /project name/ 404error.html

T
Timur, 2015-04-10
@timych

Do you have server logs? What the browser console shows (what code returns the request to the page). What version of servlets are you using (2.5 or 3.x)?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question