Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

avoiding browser chache when velocity templates are used?  RSS feed

ahamed anas
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

$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">

Still the issue persists.Suggestions/solutions needed in this regard.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!