Issue
I have some of the following imports defined like the following as shown in the image below.
I am wondering, how can I eliminate "package javax.servlet.annotation does not exist"
error. I am currently working on "Java Web" type of project in Netbeans 7.4. .
Secondly, I believe , the above error is the reason behind my second error related to "WebServlet" which is shown in the image above (line #44).
Please let me know how to fix this problem.
Read some other posts like this one, but I believe they are not using Netbeans and not sure if I should update tomcat as mentioned in the post. The location of the servlet api jar file is as shown in the image below:
Solution
WebServlet
is added in servlet-api
version 3.0, so make sure you are using updated version and it's added in the class path of the project.
Have a look at servlet-api-2.5 classes where WebServlet.class
is not included, it's part of servlet-api-3.x classes
Answered By - Braj
Answer Checked By - Clifford M. (JavaFixing Volunteer)