1. 程式人生 > 其它 >The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

初始化部署web專案常見錯誤

1、The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

新建的web專案,專案所有jsp頁面報錯如下

1)在出現此錯誤的專案上右鍵-->Build Path --> Configure Build Path

2)點選右邊的 ADD Library->server Runtime

3)選擇部署好的tomcat,即可錯誤消失。

4)如錯誤繼續存在,右鍵專案點選Refresh

5)如繼續出現錯誤,找到tomcat的安裝目錄的lib下,

或者在專案的環境下是否有servlet-api.jar包,如沒有可手動新增後再重新配置。

(之前試過百度下載的tomcat沒有servlet-api.jar)

2、There are no resources that can be added or removed from the server

專案新增不進對應的servers

專案上右鍵-->Build Path --> Configure Build Path

進入Project Facets 選中Dynamic Web Module和java