how to set header no cache in spring mvc 3 by annotation? not is
response.setHeader(\"Pragma\",\"No-cache\");
response.setHeader(\"Cache-Control\",
I know this is old but this might be helpful to some.
If you wanted to add a lot more logic to when you cache and when you don't you can also write a custom interceptor.
For example if you wanted to disable caching in the response only when the browser is IE or only from specific urls you can do that as well by extending the HandlerInterceptor interface.
By doing that you can have a lot of control over exactly what happens. It's not as easy as just setting the header for everything at once or just typing in the changes to the response in each controller but it is also not that hard and is a better long term solution in my opinion. It is also a good thing to know how to do in spring generally.
This is a pretty good tutorial for it:
http://www.mkyong.com/spring-mvc/spring-mvc-handler-interceptors-example/