Servlet-new maven report error: web.xml is missing and <failOnMissingWebXml> is set to true

web project:
new maven report error: web.xml is missing and is set to true

Solution:
Check the project and right-click ——> Java EE Tools ——> Generate Deployment Descriptor Stub . Then the system will create a web.xml file in the src/main/webapp/WEB_INF file.

Insert picture description here

Attached:

Servlet response process

1. The user sends a request from the browser, and the request is first connected by the Tomcat software. Tomcat can get the user's request path, find the corresponding Servlet class name in the web.xml configuration file through the request path, and instantiate the Servlet through reflection technology Come out and call the service method inside.

What is Servlet

• Servlet is a component specification customized by Sun to extend the functions of web service software.

•Web service software (Tomcat) is responsible for establishing network connections and providing static resource access capabilities. Through the Servlet component specification, Web service software can provide dynamic resource access capabilities

•Static resources and dynamic resources
1. Static resources: The content obtained by any user's request is the same content
2. Dynamic resources: Different users request different content through internal calculations of the server

The difference between creating a Class and creating a Servlet
• Creating a Servlet essentially creates a Class, but there are two more things than creating a class
• Let the class inherit HTTPServlet
• Add the correspondence between the request address and the Servlet in the web.xml file The
browser sends There are several ways to request
1. Write the request address in the address bar of the browser and press Enter to send the request
2. Send the request via the hyperlink
3. Send the request via the form

Guess you like

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