title: java- session.getattribute returns null
body: <p>I have a JSP pages that validate a user when he logs in and I would like to capture and store his username for some other uses. So here is the code when the user logs in:</p>
  
  <pre><code>  String username = request.getParameter("username");
                  String password = request.getParameter("password");
  
  session.setAttribute("username", username);
  </code></pre>
  
  <p>I debug the session value and it does indeed return the correct username value. So right now,I want to access this value from another page to see the username it returns.I call this value like below:</p>
  
  <pre><code>Value:&lt;%= session.getAttribute("username") %&gt;
  </code></pre>
  
  <p>The value returns is <code>Value:null</code> instead of the username (root). I can't figure out what went wrong. Did I do any mistake?</p>