方法一:

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

 

方法二:

Java Build Path -> Libraries ->Add Library… -> Server Runtime ->Next。 具体如下所示:

  Maven 梳理 - maven新建web项目提示"javax.servlet.http.HttpServlet" was not found on the Java Build Path

 

点击Next后选择我们之前配置的Apache Tomcat v9.0,然后点击Finish即可。添加完Libraries后不要忘记点击Apply按钮以及OK按钮。

相关文章:

  • 2021-07-19
  • 2022-12-23
  • 2021-09-06
  • 2022-01-23
  • 2022-01-06
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2021-08-14
  • 2022-01-28
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
相关资源
相似解决方案