1. 程式人生 > >MyEclipse中,使用Maven新建web項目後,提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

MyEclipse中,使用Maven新建web項目後,提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

web png -a ips cti code 使用 te pro ron

問題描述:

  使用 MyEclipse + Maven 建立了一個 Javaweb工程,在編寫 JSP頁面 時,頂端出現“紅色”的報錯信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path。如下圖所示:

  技術分享圖片

解決方法:

  在該項目中的 pom.xml 中添加下面代碼來下載servlet-api,如下所示:

    <dependencies>
        <dependency>  
            <
groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> </dependencies>

  然後 項目右鍵 --> Maven --> Update Project

即可。

MyEclipse中,使用Maven新建web項目後,提示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path