You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by John Thorhauer <jt...@phoenixcolor.com> on 2000/02/11 17:31:48 UTC

Please Help Me!!

I posted this once before and got no response.  Could someone please
help me with this or at least point me in the right direction or tell me
this makes no sense at all or something :-) 

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
********************************