The superclass "javax.servlet.http.HttpServlet" was not found on the Java错误

在使用JavaEE Eclipse创建动态web项目,server为Tomcat 7.068

描述如下:

在创建jsp页面时,会出现该错误提示[The superclass "javax.servlet.http.HttpServlet" was not found on the Java]

以及自己在编写action类中使用ServletActionContext.getRequest()获得HttpServletRequest对象时也出现错误

[The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files]

解决办法如下:

项目名右击->选择properties->点击左侧的Project Facets->再点击最右侧的Runtimes选择Apache Tomcat -> Apply->刷新项目

The superclass "javax.servlet.http.HttpServlet" was not found on the Java错误

原文地址:https://blog.csdn.net/zhangchao19890805/article/details/50646941