JSP Caching

I have a set of JSP which I do nto want to cach. I tried using the folowing:

      <meta http-equiv="Pragma" content="no-cache">
      <meta http-equiv="Cache-Control" content="no-store">

but it does not seem to work even though I have re-started tomcat after deleting its work direcotry. Is there anyone who can give me a clue why this is happening or why the above did not make any effect.

Who is Participating?
bloodredsunConnect With a Mentor Commented:
use this (from TimYates)

        // Set to expire far in the past.
        response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
        // Set standard HTTP/1.1 no-cache headers.
        response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
        response.addHeader("Cache-Control", "post-check=0, pre-check=0");
        // Set standard HTTP/1.0 no-cache header.
        response.setHeader("Pragma", "no-cache");
limaidealConnect With a Mentor Commented:
Sometime, browser or proxy doesn't respect the HTTP header.
One workaround could be append a dummy parameter in your URL, such as "rnd=213657192312"
Try to go to the web directory in tomcat. Try to edit the file or the page by putting a space in the first and save it. And reload the page.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.