"javax.servlet.http.HttpServlet" was not found

在eclipse中,用maven新建web项目时,jsp页面报错:

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

说明缺少httpServlet,解决方法是:

右键项目-Properties-Targeted Runtimes-选择自己要运行的服务器,比如 Apache Tomcat v7.0-ok!

据说也可以在pom.xml中添加

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>servlet-api</artifactId>
	<version>2.5</version>
</dependency>

你可能感兴趣的:("javax.servlet.http.HttpServlet" was not found)