File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes avoiding browser chache when velocity templates are used? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "avoiding browser chache when velocity templates are used?" Watch "avoiding browser chache when velocity templates are used?" New topic
Author

avoiding browser chache when velocity templates are used?

ahamed anas
Greenhorn

Joined: Jun 13, 2012
Posts: 1
We have separate velocity templates for each page.Then to render a page, we will get the merged vm template as a string and then flush to a jsp.
The issue is we need to eliminate browser chaching for few pages.We have added the following codes both in the flushed jsp and vm template.But
the content is still browser cached and this isue is happening for windows XP and not with other OS.We need to eradicate this issue as XP is mostly used.

Added
$response.setHeader("Expires", "Mon, 23 Aug 1982 12:00:00 GMT")
$response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate")
$response.addHeader("Cache-Control", "post-check=0, pre-check=0")
$response.setHeader("Pragma", "no-cache")
inside Head tag of all velocity templates. And response obj is added to context map. Added the same snippet in jsp.

Also added the <Meta> tag in all velocity templates as
<META HTTP-EQUIV="Cache-control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">

Still the issue persists.Suggestions/solutions needed in this regard.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: avoiding browser chache when velocity templates are used?
 
Similar Threads
pressing back button after logout shows loggedin contents
how to prevent caching in IE 6
invalidate session object in struts2
disable the back button in webapplication
After Logout still keeping session