`
hello_world_hello
  • 浏览: 8490 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

url 映射

    博客分类:
  • j2ee
 
阅读更多

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

 

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics