You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by John Thorhauer <jt...@phoenixcolor.com> on 2000/02/10 17:15:04 UTC
Session isNew() always returns true??
I am trying to do some work with sessions and I am trying to make sure
that the session is established with isNew() but it always returns
true. In my case the session should not be new because I put data in
the session and was able to retrieve the data from within in the same
servlet but the isNew() call always returns true. Any ideas??
Here is a snippet of code
----------------------------------------------------------------------------------
HttpSession TestSession = request.getSession(true);
TestSession.setAttribute("testing","this is a test");
System.out.println("id=" +TestSession.getId()) ;
HttpSession TestSession2 = request.getSession(true);
System.out.println("isNew=" +TestSession2.isNew()) ;
System.out.println("id=" +TestSession2.getId()) ;
System.out.println("attribute testing = " +
TestSession2.getAttribute("testing") );
------------------------------------------------------------
here is the output of the code
------------------------------------------------------
id=To1010mC5245131899080997At
isNew=true
id=To1010mC5245131899080997At
attribute testing = this is a test
---------------------------------------------------------
Thanks,
John
********************************
** John Thorhauer
** Web Developer
** jthorhauer@phoenixcolor.com
********************************