Servlet mapping configuration

1. Configure the web.xml file

insert image description here
First <url-pattern>intercept the request, then look for the same name as <servlet-mapping>in , and then jump to his<servlet-name><servlet-><servlet-class>

2. Annotation method (Servlet3.0)

It is no longer necessary to configure in web.xml, just write the following code at the beginning of the servlet.
@WebServlet(name = "xxx(一般系统自动生成)",urlPatterns = {"/xxx"})

Guess you like

Origin blog.csdn.net/weixin_45062600/article/details/106564752