title: Cannot clear session using javascript in jsp
body: <p>created session from login.jsp page using servlet</p>
  
  <pre><code>String msg = "";
          HttpSession sess = request.getSession();
         // if(sess != null)
  
          //sess.invalidate();
          if (sess.getId() != null) {
              sess.setAttribute("uname", uname);
              sess.setAttribute("pwd", pwd);
          }
  </code></pre>
  
  <p>retrived  session in other jsp page using</p>
  
  <pre><code>&lt;b&gt; Welcome ${uname}&lt;/b&gt;
  </code></pre>
  
  <p>logout hyperlink</p>
  
  <pre><code>&lt;a href="login_ml.jsp" id="logout_link" onclick='lgt()'&gt;Logout&lt;/a&gt;&lt;/td&gt;   
  </code></pre>
  
  <p>javascript to clear session</p>
  
  <pre><code>function lgt(){
                  var logout = document.getElementById("logout_link");
                  logout.session.clear();
                  alert("logout");
                  }
  </code></pre>