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>

Marc Raygoza

Marc is the Founder of HybrisArchitect.com.
He enjoys helping others learn more about SAP Commerce Cloud (Hybris). Marc is a SAP Commerce Certified Professional and has held the role of SAP Commerce Cloud Architect at Deloitte, PwC, Brillio (a Bain Company), and Nasty Gal. 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: mraygoza@hybrisarchitect.com

You may also like...

Popular Posts