web.xml 中配置errorPage
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
... ...
<error-page>
<error-code>403</error-code>
<location>/WEB-INF/view/error/403.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/view/error/404.jsp</location>
</error-page>
<error-page>
<error-code>405</error-code>
<location>/WEB-INF/view/error/405.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/view/error/500.jsp</location>
</error-page>
<error-page>
<error-code>502</error-code>
<location>/WEB-INF/view/error/502.jsp</location>
</error-page>
<error-page>
<error-code>503</error-code>
<location>/WEB-INF/view/error/503.jsp</location>
</error-page>
<error-page>
<error-code>504</error-code>
<location>/WEB-INF/view/error/504.jsp</location>
</error-page>
</web-app>