Every thing was fine and i was able to run this JSP project, suddenly some thing happened and mostly all my servlets getting unresolved error.
I know its because sp
You have to set the runtime for your web project to the Tomcat installation you are using; you can do it in the "Targeted runtimes" section of the project configuration.
In this way you will allow Eclipse to add Tomcat's Java EE Web Profile jars to the build path.
Remember that the HttpServlet class isn't in a JRE, but at least in an Enterprise Web Profile (e.g. a servlet container runtime /lib folder).
A simple solution for me was to go to Properties -> Java Build Path -> Order and Export, then check the Apache Tomcat library. This is assumes you've already set Tomcat as your deployment target and are still getting the error.
It happened for me also and the reason was selecting inappropriate combination of tomcat and Dynamic web module version while creating project in eclipse. I selected Tomcat v9.0 along with Dynamic web module version 3.1 and eclipse was not able to resolve the HttpServlet type. When used Tomcat 7.0 along with Dynamic web module version 7.0, eclipse was automatically able to resolve the HttpServlet type.
Related question Dynamic Web Module option in Eclipse
To check which version of tomcat should be used along with different versions of the Servlet and JSP specifications refer http://tomcat.apache.org/whichversion.html
It means that servlet jar is missing .
check the libraries for your project. Configure your buildpath download **
servlet-api.jar
** and import it in your project.
I faced the same problem in eclipse with tomcat7 with the error javax.servlet cannot be resolved. If I select the server in targeted runtime mode and build project again, the error get's resolved.