Hi,giang nguyen,
you said:
So for the above mappings, only the exact matches of request URI will do. If there're more than one matches for the request you send, the first match will be chosen
but i have made an example in my
tomcat, and found that what you said is not true.the truth is that
If there're more than one matches for the request you send, the most fitable or the last match will be chosen.
my example:
...
<servlet-mapping>
<servlet-name>Header</servlet-name>
<url-pattern>/1208/header</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/1208/header</url-pattern>
</servlet-mapping>
...
in this sample, the servlet response to hello will be chose when you request
http://localhost/abc/1208/header ...
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/1208/more/header</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Header</servlet-name>
<url-pattern>/1208/more/*</url-pattern>
</servlet-mapping>
...
but in this sample, if you request
http://localhost:8080/abc/1208/more/header, the hello servlet will response to it.