Eclipse中建立Maven Web項目報錯:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

來源:互聯網
上載者:User

標籤:項目   class   sele   bsp   web項目   lips   eclips   就是   markers   

在maven web項目中的index.jsp中的錯誤資訊如下: 

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

從錯誤資訊可以看出來,找不到該類,也就是說找不到相應jar包。

所以解決方案就是引用相應jar包即可。

 

前提:

需要設定Server Runtime,

Window -> Perferences -> Server -> Runtime Environments -> Add -> Apache Tomcat ... , 這樣一步步做下去即可。

 

此問題解決方案:

工程右鍵 -> Build Path -> Configure Build Path -> Libraries -> Add Library -> Server Runtime -> 選擇通過上面上面步驟添加的server即可, 最後點擊Apply。

就可以看到jsp頁面上的錯誤消失。

 

但是你還會發現,工程上有一個小紅叉,解決如下:

首先查看Markers資訊 (Window–>show veiw–>Markers)

錯誤資訊是: 

Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project... from the project context menu or use Quick Fix. 

按提示步驟做即可解決問題!(工程右鍵 -> Maven -> Update Project)

 

Eclipse中建立Maven Web項目報錯:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.