这个问题的解决有二种解决办法:

1.加apache tomcat的运行环境即可

  选中项目点击右键

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path问题的解决_运行环境The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path问题的解决_右键_02

以上这种做法是在eclipse中的做法

2.如果是maven工程,还可以采用maven做法

就在这个工程的pom.xml配置文件中加入以下代码即可

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path问题的解决_apache_03

<scope>元素的说明:范围  默认是compile

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path问题的解决_运行环境_04

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path问题的解决_apache_05