Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Caching

 
manav kher
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though I say
setHeader("Caching","no-cache"); in my servlet response

it still does not solve the problem and i have to reload the page to see the modified content
can anyone guess why this is happening. In this case the page reads a variable from the javascript file and the servlet updates the .js file but the variable is still being cached by the client.
manav
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are two possibilities which come to mind here.
The first is that your browser is ignoring your header. Preventing browser caching of pages is strangely complex, and may require setting several headers (pragma, expires etc.) to deal with a reasonable selection of browsers.
The second is that even if this works it will only affect the page in which the header appears, and not other cacheable files such as .js files. In fact, controlling the caching of .js files is effectively impossible. If this is your problem, consider building your page dynamically and including the JavaScript value in the constructed page. Only use an external .js file for static JavaScript.
 
ram mohan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why don't u add the following header as well and see whether u can manage to get over your problem
setHeader("Cache-Control","no-store");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic