简体   繁体   中英

Error Page configuration in web.xml for JSF application

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM