為了給瀏覽者一個友好的錯誤提示頁面,我們可以象IIS一樣自定義錯誤頁面;
步驟如下:
一、打開WEB-INF文件夾下web.xml文件;
二、在里面新增:
''404頁面不存在錯誤
<error-page>
<error-code>404</error-code>
<location>/errorpage404.htm</location>
</error-page>
''505服務器內部錯誤
<error-page>
<error-code>505</error-code>
<location>/errorpage505.htm</location>
</error-page>
''java.lang.NumberFormatException異常錯誤,依據這個標記你可以定義好多,you can any fire:)!@
<error-page>
<exception-type>java.lang.NumberFormatException</exception-type>
<location>/exception.htm</location>
</error-page>
三、保存web.xml文件,reload服務即ok!
Good Luck!!