定义时注意:xml元素是区分大小写的。
这些必须小写
1)url-pattern 的值必须以/或者*.开头
2)匹配模式的规则
①优先处理完全匹配
/test1/aa 和 /test1/* 都是一个url-pattern访问路径,则优先请求 http://localhost/webapptest/test1/aa
②目录映射优先于扩展名映射
/test1/aa 和 /test1/*.html 都是合法的url-pattern访问路径,则优先请求 http://localhost/webapptest/test1/aa/test.html
③对于重复映射,越长路径越优先
/test1/aa/* 和 /test1/* 都是一个url-pattern访问路径,则优先请求 http://localhost/webapptest/test1/aa/test.html
在web.xml文件中使用 filter元素和 filter-name(任意名),filer-class(完全限定类名)声明:
通过filter-mapping与
①【servlet-name】一个元素或者多个servlet关联
②【url-pattern】jsp页面关联