我知道在web.xml中有兩種配置error-page的方法,一是通過錯誤碼來配置,而是通過異常的類型來配置,分別舉例如下:
一. 通過錯誤碼來配置error-page
Eg.
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
上面配置了當系統發生500錯誤(即服務器內部錯誤)時,跳轉到錯誤處理頁面error.jsp。
二. 通過異常的類型配置error-page
Eg.
<error-page>
<exception-type>java.lang.NullException</exception-type>
<location>/error.jsp</location>
</error-page>
上面配置了當系統發生java.lang.NullException(即空指針異常)時,跳轉到錯誤處理頁面error.jsp
posted on 2007-06-08 15:26
阿蜜果 閱讀(20785)
評論(10) 編輯 收藏 所屬分類:
Web