Eclipse中index.jsp文件显示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build

由错误可知,没有javax.servlet.http.HttpServlet类,此jar包位于Tomact的lib下,如图:

Eclipse中index.jsp文件显示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build

因此,出现此错误的原因是没有添加Tomact包。右击web工程->属性或Build Path->Java Build Path->Libraries,如图:

Eclipse中index.jsp文件显示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build

可知,Apache Tomcat v9.0 library下并没有相应的jars包文件,因此会出现找不到javax.servlet.http.HttpServlet的错误。因此,要在此library下添加额外的jar包。点击 Add External JAERs,进入Tomcat安装路径lib文件下,ctrl-a选中所有jar包添加即可。Eclipse中index.jsp文件显示The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build


相关衔接:

https://blog.csdn.net/fei20072050104/article/details/21785565

https://blog.csdn.net/u014691453/article/details/52227743