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

在eclipse中,用maven新建web項目時,jsp頁面報錯: html

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

說明缺乏httpServlet,解決方法是: web

右鍵項目-Properties-Targeted Runtimes-選擇本身要運行的服務器,好比 Apache Tomcat v7.0-ok! api

聽說也能夠在pom.xml中添加 服務器

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>servlet-api</artifactId>
	<version>2.5</version>
</dependency>
相關文章
相關標籤/搜索