Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How do you define multiple filters in JSP?
Your web application may define several different filters with a specific purpose. Consider, you define two filters AuthenFilter and LogFilter. Rest of the process will remain as explained above except you need to create a different mapping as mentioned below −
LogFilter LogFilter test-param Initialization Paramter AuthenFilter AuthenFilter test-param Initialization Paramter LogFilter /* AuthenFilter /*
Filters Application Order
The order of filter-mapping elements in web.xml determines the order in which the web container applies the filter to the servlet or JSP. To reverse the order of the filter, you just need to reverse the filter-mapping elements in the web.xml file.
For example, the above example will apply the LogFilter first and then it will apply AuthenFilter to any servlet or JSP; the following example will reverse the order −
AuthenFilter /* LogFilter /*
Advertisements
