title: prevent going back to previous page after logging out
body: <p>login.html</p>
  
  <pre><code>    &lt;form method="get" action="NewServlet"&gt;
          name: &lt;input type="text" name="user"&gt;
          &lt;br&gt;
          pass: &lt;input type="password" name="password"&gt;
          &lt;br&gt;
          &lt;input type="submit"&gt;
      &lt;/form&gt;
  
   NewServlet
  
  
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter out = response.getWriter();
      String s = request.getParameter("user");
      String pass = request.getParameter("password");
      UserBean bean=new UserBean();
      bean.setLogin(request.getParameter("user"));
      bean.setPassword(request.getParameter("password"));
        if(bean.getLogin().equals("admin")&amp;&amp;bean.getPassword().equals("prerna"))
  
     {
         HttpSession session=request.getSession(true);
  
         request.setAttribute("user",bean);
         session.setAttribute("user",request);
  
         RequestDispatcher rd=request.getRequestDispatcher("/show.jsp");
         rd.forward(request,response);
      }
    else
   {
  response.sendError(404, "invalid usename or password");
     // response.sendRedirect("http://www.google.com");
     out.print("&lt;H1&gt;ERROR&lt;/H1&gt;");
  
  
   }
  
   loginout.jsp
  
  &lt;%
  
    session.invalidate();
    response.sendRedirect("login.jsp");
  
  %&gt;
  </code></pre>
  
  <p>when I click on back button my previous page gets displayed which i don't want.
  can anyone suggest me a solution for this problem</p>