我们可以在tomcat中配置要显示的任何页面而不是page not found
错误页面。
如果是,那么How ??
答案 0 :(得分:1)
在<error-page>
中声明web.xml
,其中您可以指定应在特定Throwable(或其任何子类)上显示的页面或HTTP状态代码。 E.g。
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsp</location>
</error-page>
将在java.lang.Exception
,或者
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
将显示HTTP 404错误的错误页面,