<url-pattern> in servlet mapping rules

In the process of using servlet, we will configure the url-patterm attribute in web.xml, which, for example, follows the following specifications:

1. Start with a "/", start with a "/*", use the above specification to match similar paths such as /path/*

2. Start with a "*." character and end with a specific character

<servlet-mapping>
		<servlet-name>appServlet</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>

 

3. A string sequence starts with a "/" character, but does not end with a "*" character

<servlet-mapping>
		<servlet-name>appServlet</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

 

The url-pattern attribute we configure can satisfy one of the specifications. If it does not match, it will prompt Invalid <url-pattern> in servlet mapping error message.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326944909&siteId=291194637