title: Stop jsp page from caching
body: <p>Okay, so my nocache filter doesn't seem to work. I've read other stackoverflow questions but their answers doesn't seem to work too. I'm using firefox. Tried clearing cache, restarted tomcat. Filter is called too and header shows page is not cached. BUT when I click the back button page still loads..what to do?</p>
  
  <pre><code>public void doFilter(ServletRequest request, ServletResponse response,
          FilterChain chain)
          throws IOException, ServletException {
      HttpServletResponse httpResponse = (HttpServletResponse) response;
      HttpServletRequest httpRequest = (HttpServletRequest) request;
      // Set standard HTTP/1.1 no-cache headers.
      httpResponse.setHeader("Cache-Control", "private, no-store, no-cache, must-revalidate");
      // Set standard HTTP/1.0 no-cache header.
      httpResponse.setHeader("Pragma", "no-cache");
      httpResponse.setDateHeader("Expires", 0); //prevents caching at the proxy server
      String method = httpRequest.getMethod();
      String URI = httpRequest.getRequestURI();
      System.out.println(method + " request invoked on " + URI);
      chain.doFilter(httpRequest, httpResponse);
  }
  </code></pre>
  
  <p>EDIT: I also did try putting &lt; meta> tags, no good..</p>