将以下代码放入项目下的web.xml中
<!-- 错误处理 -->
<error-page>
<error-code>404</error-code>
<location>/error/error404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/error500.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/error/errorNull.jsp</location>
</error-page>
error-code:表示错误码
exception-type:表示异常类型
然后编写对应的错误处理页面就行了
WebRoot页面就行了