0 Replies Latest reply on Nov 4, 2004 10:53 AM by Darren Strachan

    Session object is renewed on page change

    Darren Strachan Newbie


      Hi everyone,

      I am new to building web applications with JSP/JBoss and am having some problems with the JSP "session" object that I wonder if anyone can help with. On my application login page I use the following call to set a UserName attribute on the session object:

      session.setAttribute("UserName", <username from login form>);

      I want to be able to use this attribute on subsequent pages to display a welcome message to the user. So I expected to be able to get this information by calling:

      session.getAttribute("UserName");

      The problem is that this method call returns null instead of the value i'm expecting. Digging a bit deeper using the likes of "session.isNew()" and "session.getId()" shows that a new session is being created for pages subsequent to the login page. Seems like I need to somehow group the pages together but i'm not sure how to do this....

      any feedback on this would be greatly appreciated...

      Thanks,
      Darren