Web.xml
<!-- 声明普遍型错误 -->
< error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/ errorpage. jsp</location>
</ error-page>
<!-- 根据异常声明错误页面 -->
< error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/null error. jsp</location>
</ error-page>
<!-- 根据http状态码声明错误页面 -->
< error-page>
< error-code>404</ error-code>
<location>/notfound error. jsp</location>
</ error-page>
<!-- 声明普遍型错误 -->
< error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/ errorpage. jsp</location>
</ error-page>
<!-- 根据异常声明错误页面 -->
< error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/null error. jsp</location>
</ error-page>
<!-- 根据http状态码声明错误页面 -->
< error-page>
< error-code>404</ error-code>
<location>/notfound error. jsp</location>
</ error-page>