DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

在MyEclipse创建Dynamic Web Project项目,在项目中jsp页面报错:

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

如图:

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

解决方案:

①eclipse是否配置了tomcat服务器

如果没有则需要配置tomcat:

点击下载tomcat:点击打开链接

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

解压到D盘:

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

window-preferences

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

MyEclipse-Servers-Tomcat

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

Enable-Tomcat home directory

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath


②配置完tomcat,向报错的动态网页项目添加Tomcat Runtime Libraries

右击报错的项目名-Build Path-Configure Build Path...

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

Java Build Path-Libraries-Add Library...

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

MyEclipse Server Library-Next(需要注意的是,这里不同于Eclipse,Eclipse在这里的选项是:Server Runtime,而MyEclipse在这里的选项则是:MyEclipse Server Library,没有Server Runtime选项

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

选择自己下载的Tomcat,我这里是Tomcat Version7.0,然后点击finish,

退到前一个配置页面还要点击OK这个时候配置完成

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath

动态网页项目报错消失,错误顺利解决。

DynamicWebProject报错The superclass"javax.servlet.http.HttpServlet"was not found on the Java BuildPath