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

在创建maven web工程时,我们遇到了“The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path”的问题。详见博文:http://www.cnblogs.com/Answer900310/p/5390008.html 如图所示

QQ截图20160413170200

项目工程结构中的jsp页面会出现小红叉,同时在控制台Problems中会报错。

  • 解决办法:

1.右键工程,选择“Build Path-Configure Build Path”

image

点击“Add Library”按钮

image

选择“Server Runtime”选项,点击“next”按钮。

image

选择已经配置好的tomcat服务器,点击“Finish”按钮。如此处没有tomcat应用服务器,请先进行配置。

image

点击“Apply”按钮

image

即可解决,解决之后的工程如图所示:

image

原文地址:https://www.cnblogs.com/Answer900310/p/5390044.html