" Sometimes I pretend to be normal. But it gets boring. So I go back to being me. "

I don't know

Handling 404 Error in Java EE



Showing a customized 404 page makes your visitors feel good. Well I think so. If you don't handle the 404 error by yourself, then your web server will produce that ugly error message which at least makes me feel uncomfortable.


If you are running a Java Web application, handling 404 error is a cakewalk. Just configure your error page in web.xml and thats it

        
        <error-page>
             <error-code>404</error-code>
             <location>/WEB-INF/jsps/404.jsp</location>
        </error-page>
        
        

Above we have configured 404.jsp as error page for 404 error. Similarly you can configure error pages for other error codes like 403, 401 etc.






If you have any queries or suggestions, please mention it in the comments below.