Home > how to > how to specify error page in web.xml

How To Specify Error Page In Web.xml

Lab Marketing Automation Lab Video Management Lab Docker Lab Docker and Tutum lab Spring Aspects Library Lab Spring Security Lab Swagger Lab Imaging Lab GroovyScript Lab nginx reverse proxy Lab Custom Workflow Lab REST endpoints Lab JSON API Lab Hippo sitemenus over REST Lab Tutorials 11.x Tutorials Getting Started Hello World Building a Website Relevance Trail Feeding an AngularJS App Documentation 11.x Reference Docs Releases Understand Hippo Implement Hippo Extend Hippo Integrate Hippo Run Hippo Upgrade Hippo Develop Hippo Use Hippo Report an Issue Releases Release Notes & Docs Community Get Involved Forum Guidelines GetTogether 2014 GetTogether 2013 Community Update Releases Understand Hippo Implement Hippo Development Environment Setup Content Repository Content Modeling Container Configuration Component Development Templating Multi Domain, Channel, Lingual setup Channel Manager Web Files URLs Search Forms I18N support Rewriting Rich Text Fields Error Pages By web.xml By Catch All Sitemap Item Simple Exception Handling Advanced Exception Handling Faceted Navigation Session Pooling Security Relevance Module HST Synchronous Event Publishing Custom JCR Event Listener Troubleshoot Static Webapp Resources Serving Binary Content Resources Quick Wins Content and Configuration Updates Release Management Extend Hippo Integrate Hippo Run Hippo Upgrade Hippo Develop Hippo Use Hippo Report an Issue See also... 2. Add a catch-all sitemap item that creates a dynamic 404 page 3. Simple exception handling HST error pages and error handling 4. Advanced exception handling Implement Hippo > Error Pages > By web.xml Show history 1. Handling error codes and exceptions by the web.xml In your web.xml you can configure error-page elements that act upon some error-code or exception-type. Typically, you might configure at the end of your web.xml the following:   400   /WEB-INF/jsp/errorpages/ErrorPage400.jsp   401   /WEB-INF/jsp/errorpages/ErrorPage401.jsp   403   /WEB-INF/jsp/errorpages/ErrorPage403.jsp   404   /WEB-INF/jsp/errorpages/ErrorPage404.jsp  

Servlets - Life Cycle Servlets - Examples Servlets - Form Data Servlets - Client Request Servlets - Server Response Servlets - Http Codes Servlets - Writing Filters Servlets - Exceptions Servlets - Cookies Handling Servlets - Session Tracking Servlets - Database Access Servlets - File Uploading Servlets - Handling Date Servlets - Page Redirect Servlets - Hits Counter https://www.onehippo.org/library/concepts/error-pages-and-error-handling/1.-handling-error-codes-and-exceptions-by-the-web.xml.html Servlets - Auto Refresh Servlets - Sending Email Servlets - Packaging Servlets - Debugging Servlets - Internationalization Servlet Useful Resources Servlets - Questions and Answers Servlets - Quick Guide Servlets - Useful Resources Servlets - Discussion Selected Reading Developer's Best Practices Questions and Answers Effective https://www.tutorialspoint.com/servlets/servlets-exception-handling.htm Resume Writing HR Interview Questions Computer Glossary Who is Who Servlets - Exception Handling Advertisements Previous Page Next Page When a servlet throws an exception, the web container searches the configurations in web.xml that use the exception-type element for a match with the thrown exception type. You would have to use the error-page element in web.xml to specify the invocation of servlets in response to certain exceptions or HTTP status codes. web.xml Configuration: Consider, you have an ErrorHandler servlet which would be called whenever there is any defined exception or error. Following would be the entry created in web.xml. ErrorHandler ErrorHandler ErrorHandler /ErrorHandler 404 /ErrorHandler 403 /ErrorHandler