The solution to javax.servlet does not exist

The solution to javax.servlet does not exist


When using HttpServlet with eclipse, it prompts the error that javax.servlet does not exist.

At this time, because of the lack of javax.servlet related class libraries in the dependent libraries of the project.

Download javax.servlet

Servlet related class packages are included in Tomcat, we can download Tomcat to get.

For example, the class library location is: apache-tomcat-7.0.107/lib/servlet-api.jar

Solution 1: Add the class library to the jre extension directory

Copy servlet-api.jar to the "JDK\jre\lib\ext" directory and recompile it.

Solution 2: Add project dependencies

  1. Select the project, right click, and select Build Path:

Insert picture description here

  1. Just add the corresponding jar package:

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-eKMki5hI-1611113106500)(evernotecid://6FE75482-54A0-433A-9625-A01F7FEE92EC/appyinxiangcom/9896050/ENResource /p3002)]


PS: For more more content..., please check --> "Server Development"
PS: More more content..., please check --> "Server Development"
PS: More more content..., please check --> "Server Development"

Guess you like

Origin blog.csdn.net/u011578734/article/details/112860841