在新安裝eclipse之后,建一個web項目,新建jsp文件,會出現一個錯誤
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
問題的原因在於 項目中缺少 tomcat相關的 類庫
這里由於是新安裝的eclipse,實際上連tomcat都沒有配置,所以解決辦法分兩步:
1. 配置外部tomcat
Window -> Preferences -> Server -> Runtime Environments -> add... ->選擇 runtime environment 的類型 ->選擇已經下載好的tomcat服務器軟件的路徑
2. 建立tomcat的library
新建項目,在項目名稱上右鍵單擊,Properties -> Java Build Path -> Libraries選項卡 -> Add Library -> Server Runtime -> 選擇 服務器軟件名稱
