title: What should i do for logout in jsp/servlet because session.invalidate() after back button click shows previouse page
body: <p>i just want help i have developed an jsp/servlet project on which i have created logout controller named LogOut.java @/servlet/Account/LogOut
  code is here</p>
  
  <pre><code>public static boolean doLogOut(HttpServletRequest request)
  {
      boolean Result = false;
  
      if(request.getSession(false) != null)
      {    
          request.getSession().invalidate();
          Result = true;
      }
  
      return Result;
  }
  </code></pre>
  
  <p>and in servlet i'm forwarding to "/" url so the most common problem is on after logout if i press Back button in browser it shows previous page and i don't want to show it so what should i do before or after logout in servlet</p>
  
  <p>i have got some thing like</p>
  
  <pre><code>add the following code to all ur .jsp pages :-
  &lt;%
  response.setHeader("cache-control","no-cache");
  response.setHeader("Pragma","no-cache");
  response.setDateHeader("Expires",0);
  %&gt;
  This thing is working for me even with the Back Button
  </code></pre>
  
  <p>is this ok i means i have to do it in all pages if i don't use the listener or some thing can be do...????????????</p>