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