Eclipse导入JavaWeb项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

时间:2023-12-05 11:29:56

JavaWeb项目中写的JSP页面需要Web容器解析处理成HTML才能展示到前端浏览器,解析JSP需要Web容器。
JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path。

Eclipse导入JavaWeb项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

Eclipse导入JavaWeb项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

javax.servlet.http.HttpServlet是Web容器Tomcat包中的类,将需要的jar包导入项目中就能解决这个问题。

下面是具体的解决方法:

  右击web工程-> Build Path-> Java Build Path-> Libraries-> Add Libray-> Server Runtime -> Tomcat Server