title: Session Problem in JSP
body: <p>I am setting and getting the session attributes on login page, when i logout the page and press the back button it goes to home page again.</p>
  
  <p>Here is my code,</p>
  
  <pre><code>::::::::::::::::::::::::::**sessionaction.jsp**::::::::::::::::::::::::::::::::::::::
  
  &lt;%@page import="java.util.*" %&gt;
  &lt;%
      String str = request.getParameter("UserName");
      session.setAttribute("sessUserName", request.getParameter("Password"));
  %&gt;
  
  &lt;%
      if (session.getAttribute("sessUserName").equals(""))
      {
          response.sendRedirect("login.jsp");
  %&gt;
  
  &lt;%
      }
  else
      {
          response.sendRedirect("home.jsp");
      }
  %&gt;
  
  
  ::::::::::::::::::::::::::**logout.jsp**::::::::::::::::::::::::::::::::::::::
  &lt;%@page import="java.util.*" %&gt;
  
  &lt;%
  //session.invalidate();
  session.removeAttribute("sessUserName");
  %&gt;
  
  You have logged out. Please
  &lt;a href="login.jsp"&gt;&lt;b&gt;Login&lt;/b&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Kindly guide me.</p>