How to solve the error which comes like this:
HttpServletRequest cannot be resolved to a type in eclipse
How to solve the error "HttpServletRequest cannot be resolved to a type"?
How to solve the error "HttpServletResponse cannot be resolved to a type"?
How to solve the error "HttpSession cannot be resolved to a type"?
For your information I am using Eclipse and maven for my project.
This error comes in project when servlet jar file is not added to project.
If you are using maven then add following line in pom.xml file:
<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency>
If you are not using maven in your project then find servlet.jar from Tomcat server and then add it to your project.
This should solve error.
First you need to configure the server then follow the steps
1.Right click on Project-->Build Path-->Configure Build Path
2.go to libraries tab -->add Library-->server run time-->Select the server-->Finish
Now u can resolve the errors