title: How to invalidate browser session
body: <p>How can I invalidate Browser Session. I am using JSP's.
  In <code>web.xml</code> the <code>session-timeout</code> is been set to 180 seconds and I want it like that only. But the problem is on some special occasion for some user's browser session need to be invalidated immediately right after a form submit.</p>
  
  <p>I have used <code>session.invalidate();</code> to invalidate session and also used </p>
  
  <pre><code>response.setHeader("Cache-Control", "no-cache");
  response.setHeader("Pragma", "no-cache");
  response.setDateHeader("Expires", 0);
  </code></pre>
  
  <p>But, still when I click the back button it will take me to the same users session. Is this loading from browser cache?</p>
  
  <p>This is what i have in my JSP : </p>
  
  <pre><code>&lt;head&gt;
  &lt;script type="text/javascript"&gt;
  function submitForm(){window.document.submitFrm.submit();}
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="submitForm()"&gt;
  &lt;%String output = (String)(request.getAttribute("strOut"));
  String hookUrl = (String)(request.getAttribute("hookUrl"));
  System.out.println("hookUrl in cwsGroup.jsp : "+hookUrl);%&gt;
  &lt;form method="post" action="&lt;%=hookUrl%&gt;" name="submitFrm" id="submitFrm"&gt;
  &lt;input type="hidden"  name="cxml-urlencoded" value='&lt;%=output%&gt;' /&gt;
  &lt;/form&gt;
  &lt;%
  response.setHeader("Cache-Control","no-cache");
  response.setHeader("Pragma","no-cache");
  response.setDateHeader( "Expires", 0 );
  session.removeValue("domineName");
  session.invalidate();%&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Am I missing something?</p>