The following table: unable to import javax. Servlet. HttpServletRequest

Don’t panic in case of data tilt, teach you to easily obtain the slope of table tilt>>>

We often copy other people’s projects to ourselves for secondary development or reference. Sometimes the above error occurs, that is, in the eclipse project, our imported project prompts that HttpServletRequest can’t be referenced, which will be accompanied by a headache Red Cross

The specific reason is that the corresponding package package package javax.servlet.http is missing in the web inf/lib directory of our project

The jar package supporting servlets is called servlet-api.jar

If you have ever written a servlet, you know that you need to use objects such as HttpServletRequest and httpservletresponse. These objects can only be used by this jar package

Generally speaking, lacks Tomcat_ Servlet API. Jar under home/lib

I import other people’s projects. He configures the server on other people’s machines, which is usually Tomcat. In the process of copying, those libraries of the server will not be copied with the project, unless someone else has copied Tomcat’s library to WEB-INF/lib

Possible 1 solution: select the local servlet-api.jar into the project

Possible 2 solutions:

Similar Posts: