servlet url 路径映射可分为大致分为以下几种情况:
1) 精确匹配
2) 通配匹配(最长路径匹配)
3) 扩展匹配
4) 默认匹配(如果以上都不匹配,则匹配默认的 “/”)
匹配举例:
HelloServlet1 --> /hello 在web.xml中的映射路径
HelloServlet2 --> /* 最长路径匹配
HelloServlet3 -->*.do 扩展匹配
HelloServlet4 -->/(默认匹配)
访问路径:web0100 为web应用根目录
http://localhost:8080/web0100/ 匹配HelloServlet2
http://localhost:8080/web0100/hello 匹配HelloServlet1
http://localhost:8080/web0100/hello/a 匹配HelloServlet2
http://localhost:8080/web0100/hello/a.do 匹配HelloServlet2