Default parameters filter ver. 1.2


This is a Java servlet filter (as per Servlet API 2.3). This filter lets you define the default parameters for HTTP requests.

How to use it:

a) download defparamflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. Initial parameters must describe your default HTTP parameters. For example:
 


<filter>
  <filter-name>DefaultParamFilter</filter-name>
  <filter-class>com.cj.defparam.DefParamFilter</filter-class>
  <init-param>
    <param-name>a</param-name>
    <param-value>5</param-value>
  </init-param>
  <init-param>
    <param-name>b</param-name>
    <param-value>test</param-value>
  </init-param>
</filter>

c) describe a mapping for this filter in web.xml
 


<filter-mapping>
  <filter-name>DefaultParamFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

and now your request will have the above mentioned default parameters a and b.

Also you can describe values for your parameters in the following form:

application.some_name

and

session.some_name

in this case filter will lookup some_name attribute in the appropriate scope (application or session) and use its value as a parameter.

   For downloading:

    Default parameters filter:  defparamflt.jar

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: