# [Java]如何設定錯誤發生時導入錯誤頁面 ###### tags: `Java` 1. 在web.xml設定 2. 可分成兩種錯:exception和http status exception: ```xml <web-app> <error-page> <exception-type>java.lang.NullPointerException</exception-type> <location>/NullPoint.html</location> </error-page> </web-app> ``` http status: ```xml <web-app> <error-page> <error-code>403</error-code> <location>/error404.html</location> </error-page> </web-app> ```