Configure a filter initialization parameters
And Servlet Similarly, the filter may be arranged initialization parameters, initialization parameters of the filter, the filter can only be used in the current
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>com.chinasofti.ch10.filter.LoginFilter</filter-class>
<init-param>
<param-name>start</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>end</param-name>
<param-value>6</param-value>
</init-param>
</filter>
In LoginFilter configured in two initialization parameters, the time period required to represent access control points 2-6 in the morning, at other times need not
How to get initialization parameters
Initialization parameters of the filter, using the method of obtaining getInitParameter FilterConfig interface. The object is a parameter init method FilterConfig filter class, therefore, is often obtained in the init method of the filter parameters of the filter class.
public class LoginFilter implements Filter