[Opensource] How to use PersistentSesssion

Mike Traum mtraum at cirnetwork.org
Mon Mar 31 09:56:09 PST 2003


It does sound like you are getting a new session for each request. Does your
browser support (and have enabled) cookies? Sessions generally use cookies
and extra steps are required to support sessions without cookies.

mike

-----Original Message-----
From: Jefferson Magno [mailto:jefferson at boavistanet.com.br]
Sent: Friday, March 28, 2003 12:54 PM
To: Lista Expresso
Subject: [Opensource] How to use PersistentSesssion


Hello all,

I need to save an object into the session context to use it across
multiple states in a controller. I tried the following:

In the first state:

PersistentSession session = request.getSession();
session.setPersistentAttribute( "name1", obj1 );

In other states:

PersistentSession session = request.getSession();
Object obj1 = session.getPersistentAttribute( "name1" );

but it didn't work, the obj1 came null.

I made another test: I wrote in both states:
System.out.println( "Session: " + session );
and, for my surprise, the Strings representing the session objects were
different. What's happening? Is each state using a different session
object?


Thks a lot.

Jefferson Magno


_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/



More information about the Opensource mailing list