title: Why the session attribute is coming as null
body: <p>A HTML5 UI is connected to the backend (REST Jersey to business logic to Hibernate and DB). I need to create and maintain a session for each user login until the user logs out.</p>
  
  <p>I am clueless on how to approach this problem.</p>
  
  <p>I followed this approach </p>
  
  <p>Initially when the User is successfully logs in , i am setting attribute under session as shown below </p>
  
  <pre><code>HttpSession session = request.getSession(true);
  session.setAttribute("islogged", "islogged");
  String value = (String)session.getAttribute("islogged");
  System.out.println("****************** The User Logge in Value"+value); 
  </code></pre>
  
  <p>Later in  a different page i am checking if the user is logged in or not this way </p>
  
  <pre><code>public String checkIfUserLoggedIn() throws JSONException,ClassNotFoundException, SQLException
      {
          HttpSession session = request.getSession();
           String value = (String)session.getAttribute("islogged");
  
          if(value==null)
          {
              // always its coming here only
  
          }
  
      }
  </code></pre>