You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by temp temp <mi...@yahoo.com> on 2006/03/31 17:49:39 UTC

servlets filters

  
  
  
  I have a servlet filter which should behave  different for  different ".do's"  and init params are  different for  different  ".do's" .
  
  One way of solving this situation is  below.
  
  
    <filter>
        <filter-name>SearchResultsFilter.CheckIn</filter-name>
      <filter-class>com.reisys.fema.ndsp.web.filter.SearchResultsFilter</filter-class>
      <init-param>
        <param-name>req_attribute_name</param-name>
        <param-value>taskInstances</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>SearchResultsFilter.CheckIn</filter-name>
      <url-pattern>/action/workflow/taskinstance/checkin.do</url-pattern>
    </filter-mapping>
  
    <filter>
        <filter-name>SearchResultsFilter.Assign</filter-name>
      <filter-class>com.reisys.fema.ndsp.web.filter.SearchResultsFilter</filter-class>
      <init-param>
        <param-name>req_attribute_name</param-name>
        <param-value>workInstances</param-value>
      </init-param>
    </filter>
    <filter-mapping>
      <filter-name>SearchResultsFilter.Assign</filter-name>
      <url-pattern>/action/workflow/workinstance/assign.do</url-pattern>
    </filter-mapping>
  
  
  
  
  Other approach is to create an xml or property file with a list of  servlet paths  and their init params  and pass this config  file to filter so that the filters retrieves servlet path from request  matches it with  the servlet path in config file and gets the  param for that    ".do"
  Which is better approach ?
  Than ks & Regards
  
  
		
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.