web.xml中配置錯(cuò)誤處理
1.使用<error-page>元素來(lái)避免讓用戶看到HTTP404或HTTP500錯(cuò)誤。
<error-page>
<error-code>404</error-code>
<location>/error_404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error_500.jsp</location>
</error-page>
2.配置<error-page>讓W(xué)eb容器捕獲如下異常:
<1>RuntimeException或Error
<2>ServletException或它的子類
<3>IOException或它的子類
<error-page>
<exception-type>javax.servlet.ServletException</exception-type>
<location>/error.jsp</location>
</error-page>








<1>RuntimeException或Error
<2>ServletException或它的子類
<3>IOException或它的子類




posted on 2007-08-01 14:25 itkui 閱讀(944) 評(píng)論(0) 編輯 收藏 所屬分類: Java