How Do You Setup Custom Error Pages in the web.xml File?

Prior to go-live, it's important to establish custom error pages to prevent unexpected behavior from those pesky 500 HTTP status codes. Although you could perform a similar implementation using the Apache Web Server, you may also configureĀ custom error pages using Hybris Commerce's web.xml file using the following XML snippet:

<error-page>
<error-code>500</error-code>
<location>/WEB-INF/views/mobile/pages/error/ServerError.jsp</location>
</error-page>
<error-page>
<error-code>503</error-code>
<location>/WEB-INF/views/mobile/pages/error/ServerError.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/views/mobile/pages/error/ServerError.jsp</location>
</error-page>

About the author

Marc is the Founder of HybrisArchitect.com. He enjoys helping others learn more about SAP Hybris Commerce. Marc has held the role of Hybris Architect at Exemplis and Nasty Gal. He is a long-time Java/Spring developer. Marc holds an M.S. Software Engineering from Carnegie Mellon University and a B.S. in Accountancy from California State University, Fresno. He can be reached at: info@hybrisarchitect.com

Add a Comment

Your email address will not be published. Required fields are marked *