Women in Technology

Hear us Roar



Article:
  Two Servlet Filters Every Web Application Should Have
Subject:   nocache problem
Date:   2004-10-26 23:59:05
From:   dmeikle
I understand that on pages that are posted (ie: input form) you don't want that cached, otherwise it won't recognize the new params past.


in the web.xml I use:


<filter-mapping>
<filter-name>CacheFilter</filter-name>
<url-pattern>*.do</url-pattern>
<init-param>
<param-name>/business.search.do</param-name>
<param-value>nocache</param-value>
</init-param>
<init-param>
<param-name>cacheTimeout</param-name>
<param-value>1</param-value>
</init-param>
</filter-mapping>


where the url /business.search.do is a posted page searching for businesses by keywords. It keeps caching. so I tried to add in the filter if(request.getMethod().equalsIgnoreCase("post")){
//code here to exit the filter
}


but it comes up with a can of worms full of errors.


suggestions?