You have to add the Servlet API to your classpath. In the Tomcat, this is in a JAR called servlet-api.jar in its lib folder. You can do this in two ways:
Leave the JAR in the lib folder of Tomcat
Right-click your project, click on properties->Java Build path->Libraries tab->click Add External JARs->Browse for servlet-api.jar and select it->click OK to update the build path.
Copy the JAR into your project
Right-click the project, click properties->Java Build Path->click ADD JARs->find servlet-api.jar in the project and select it->click Ok to update the build path.
Want to learn Java? Check out the Java course from Intellipaat.