Tuesday, May 01, 2007

Setting nocache headers in Struts Applications

In older versions of struts, it was a common practise to extend the ActionServlet and set the no-cache response headers there, so that they are applied to all requests.

In Struts 1.2.x, there is a easier way - without writing a single line of Java code.
Just add the "nocache" attribute to the controller element in struts-config.xml file.

<controller
processorClass="MyRequestProcessor"
nocache="true" />