Disabling client side cache...


Web tier: servlets, JSP, Web frameworks: Disabling client side cache...

  1. Disabling client side cache... (3 messages)

       I see that my browser insists on loading stale pages from its cache instead of from the server. Can I disable this (not by changing the browser settings)? Is there a way to force the browser to load the page from the server?
       Thanks in advance!
  2. add this in the head part of the html

    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    <META HTTP-EQUIV="Expires" CONTENT="Thur, 01 Jan 1970 08:21:57 GMT">
  3. add this code in your jsp/servlet pages

    response.setHeader("Expires", "Mon, 26 Jul 1990 05:00:00 GMT");
    response.setHeader("Cache-Control" ,"no-cache, must-revalidate");
    response.setHeader("Pragma", "no-cache");
  4. Hi,
    a very convenient method is to change your web.xml like this (under your servlet-mappings):


    That's all and it works fine...
    cu Bodo