Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Caching

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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");
 
reply
    Bookmark Topic Watch Topic
  • New Topic