评:
解决问题:捕获页面错误并反到指定页面处理。
在web.xml中加入如下配置:
<!-- 404 页面不存在错误 -->
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<!-- 500 服务器内部错误 -->
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
<!-- java.lang.Exception异常错误 -->
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsp</location>
</error-page>
<!-- java.lang.NullPointerException异常错误 -->
<error-page>
<exception-type>java.lang.NullPointerException </exception-type>
<location>/error.jsp</location>
</error-page>
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/error.jsp</location>
</error-page>