How is a filter configured in the deployment descriptor?
How is a filter configured in the deployment descriptor?
Rating:
A filter is configured in the deployment descriptor as follows:
<filter>
<filter-name>Filter1</filter-name>
<display-name>filter1</display-name>
<description>This is a test filter</description>
<filter-class>FilterClass</filter-class>
<icon>
<small-icon>SmallIcon</small-icon>
<large-icon>LargeIcon</large-icon>
</icon>
<init-param>
<param-name>testfilter</param-name>
<param-value>test</param-value>
</init-param>
</filter>
Of these tags, the <filter-name> and <filter-class> tags are mandatory. The <init-param> tag is optional, and there can be many <init-param> tags present for a filter. Also, the <icon>, <description>, and <display-name> tags are optional.
A filter is mapped using the deployment descriptor as follows:
<filter-mapping>
<filter-name>Filter1</filter-name>
<url-pattern>f1</url-pattern>
</filter-mapping>
Rating:
Other articles
- What is the <jsp:invoke> standard action?
- What is the doGet() method?
- What is the HttpSessionActivationListener interface?
- What is the setContentType() method?
- What is the <init-param> parameter of the deployment descriptor?
