定義時注意: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頁面關聯