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

今天在用eclipse写项目时碰到这个问题也是十分蒙蔽了The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

在这里插入图片描述
以下是我的解决方法:

eclipse中的解决方法

右击项目->Build Path->Add Library->Runtime->选择Tomcat Server->finish
这样jsp页头的小红叉就会消失

可能会在选择Tomcat Server的时候没有tomcat可选择,这时就需要重新下载配置tomcat

通过maven解决

如果在maven web项目中碰到这样的问题
在pom.xml中加入ServletAPI依赖

	<dependency>
		<gruopId>javax.servlet</gruopId>
		<artifactId>servlet-api</artifactId>
		<version>2.5</version>
		<scope>provided</scope>
	</dependency>
原文地址:https://www.cnblogs.com/liuurick/p/10713660.html