title: How to logout the session in java
body: <pre><code>public class LogoutController1 extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
  
          HttpSession session = request.getSession(false);
  
          if(session!=null){
  
              session.invalidate();
              session=null;
          }
          request.getRequestDispatcher("Login.jsp").forward(request,response);
      }
  }
  </code></pre>
  
  <ol>
  <li>My website is allowing multiple logins at the same time with  similar and different accounts as well.I tried  session validation for every login,but it is not working.Please  help me to solve this issue regarding my website.</li>
  <li>This is code is already given in this website.I tried with the same code but it is not working.What is the problem please give  me the solution.</li>
  </ol>