Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The import javax.servlet.annotation cannot be resolved

Im trying to create servlet for my project but encountered The import javax.servlet.annotation cannot be resolved. I've already added javax.servlet and servlet-api.jar from tomcat. Please refer the image below. Servlet

like image 751
chinna_82 Avatar asked Mar 20 '12 03:03

chinna_82


Video Answer


1 Answers

By the screenshot it looks like you are importing servlet spec v2.5. The servlet annotations were added in servlet spec 3.0

http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/package-summary.html

You will want to get the jar for a newer version then what you are currently using

Here is a chart showing the Tomcat version and the servlet spec it supports http://tomcat.apache.org/whichversion.html

like image 141
Sean Avatar answered Oct 25 '22 06:10

Sean