在web.xml配置文件下配置跳转页面
<!-- 异常跳转页面 -->
<error-page>
<error-code>403</error-code>
<location>/error-404.html</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/error-404.html</location>
</error-page>
<error-page>
<error-code>405</error-code>
<location>/error-404.html</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error-404.html</location>
</error-page>
<error-page> <!--也可以指定异常类型(空指针等)-->
<exception-type>java.lang.Exception</exception-type>
<location>/error-404.html</location>
</error-page>
本文介绍如何在web.xml中配置不同类型的错误页面,包括HTTP状态码和特定异常类型的跳转设置。
771

被折叠的 条评论
为什么被折叠?



