my dog learned polymorphism*
The moose likes Struts and the fly likes Configure caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Configure caching" Watch "Configure caching" New topic
Author

Configure caching

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I was reading that I could add <controller nocache="true"/> in my struts-config.xml file. Struts would modify each response header as follows:

response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);

My question is where would I add the <controller nocache="true"/> element. I already have a controller element i.e.

<controller>
<set-property property="processorClass" value="com.td.idcs.action.SessionFilter"/>
</controller>

and I placed <controller nocache="true"/> above it but that produced no results. Can someone please help.

Thank you for your time.
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
You can only one controller element in struts-config.xml. Add the attribute or element for "nocache=true". Since you have custom controller class, guess it is extending standard RequestProcessor. You need to ensure that processNoCache() method is invoked.
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I now included no cache to controller element nocache="true. I also included

protected void processNoCache(HttpServletRequest request, HttpServletResponse response){
super.processNoCache(request, response);
}

in my controller class, but it doesnt produce the expected result.
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
I am not sure what is problem. You can do a simple check on response object to see if the header's has been set. Is it setting the no-cache meta attribute on response header?
john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
sorry ignore my last post it works. thank you very much for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configure caching
 
Similar Threads
Struts validation problem..
cookie problem with IE. how to disable them?
form bean
Changes not effect in JSP
how to remove history from jsp pages