New maven (servlet project) cannot introduce HttpServlet

An error is reported when inheriting HttpServlet, usually Apache tomcat is not added under libraries

An error is reported when inheriting HttpServlet, usually Apache tomcat is not added under libraries

Insert picture description here
Solution:
①Right click on the project src file> build path and select Configure Build Path

Insert picture description here
②Select Libraries and click add Library

Insert picture description here
③Select Server Runtime to proceed to the next step

④ Select Apache Tomcat v7.0 (the corresponding version) and click ok. If it doesn't work, refresh the project and it will come out
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Guess you like

Origin blog.csdn.net/weixin_44182157/article/details/109248887