0
votes

I have tried to configure error page in web.xml using error-page element, but the error page is never shown rather the exceptions are thrown out in raw form to the user viewing the application.

What should I do about it? I have not found any clue as to why is this so. Any help is highly thankful.

Regards, Asif

1
How exactly did you configure it? How exactly did you test it?BalusC

1 Answers

4
votes

You can add error pages for Exception as follows

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

    <error-page>
        <exception-type>your.company.YourException</exception-type>
        <location>/errorPage.html</location>
    </error-page>

Recheck the Exception type if you want to show error page on all type of exception then use java.lang.Exception