The reason for this problem is that your Eclipse project did not import the Tomcat class library required for JSP operations, mainly Servlet-api.jar files (or Servlet.jar), which are in the Tomcat container, in the following location:%tomcat_ Home%/common/lib/servlet-aip.jar, you want to import it into your project's build path (if you are using Eclipse).
Import method: Right-click your Eclipse project and choose Build Path--Configure build path. Click on the Library tab, and clicking the Add Library button on the right in the Add Library dialog box that appears, select Server Runtime, click Next, and in the dialog box that appears, select the Tomcat server that you are using, for example, my Apache tomcat v5.5, click Finish. Your Tomcat class library is added to the current project.
Expand the Java resources:src->libraries in turn to see that the Apache Tomcat V5.5[apache Tomcat v5.5] class library has been added to the current project.
Note: For the contents of configuring the Tomcat server in Eclipse, omit it here.