1 servlet与filter的url-pattern设置方式:
 2 
 3 1、精确匹配:
 4 /directory/file1.jsp
 5 /directory/file2.jsp
 6 /directory/file3.jsp
 7 
 8 2、目录匹配:
 9 /directory/*
10 
11 3、扩展匹配:
12 *.jsp
13 
14 注意:下面的不支持:
15 /direcotry/*.jsp
16 
17 /和/*之间的区别18 <url-pattern>/</url-pattern>: 会匹配到/login这样的路径型url,不会匹配到模式为*.jsp这样的后缀型url
19 <url-pattern>/*</url-pattern>:会匹配所有url:路径型的和后缀型的url(包括/login , *.jsp , *.js 和 *.html 等)
20 <url-pattern>/</url-pattern>: 甚至会造成The requested resource () is not available.

 

相关文章:

  • 2021-08-07
  • 2021-12-03
  • 2022-01-26
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-11-02
  • 2021-12-14
  • 2021-08-07
相关资源
相似解决方案