Eclipse新建Web項目出現The superclass "javax.servlet.http.HttpServlet" was not found...

問題:Eclipse新建web項目出現The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

新建web項目後都,jsp頁面頂端出現“紅色”的報錯信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path,經過仔細查看,原來是javaweb工程中沒有添加tomcat運行時的相關類導致
解決方法:
方法1.找到tomcat安裝路徑,在tomcat根目錄下的lib文件夾裏,有一個servlet-api.jar,將這個jar包導入到項目中即可;
方法2:(1)右擊web工程->屬性或Build Path->Java Build Path -> Libraries -> Add Library... ->Server Runtime -> Tomcat Server
   (2)切換到Java Build Path界面中的Orader and Export,選擇Tomcat。

注意:按以上方法操作室,若打開Server Runtime 後一篇空白,需要設置Apache服務器。
步驟:Window->Preferences ->Server ->Runtime->Environment->add->選擇Apache的版本後點next,再填入你的Apache服務器軟件的安裝地址。

http://blog.csdn.net/dream_angel_z/article/details/44875213
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章