[Opensource] How to use PersistentSesssion

Jefferson Magno jefferson at boavistanet.com.br
Fri Mar 28 10:54:22 PST 2003


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





More information about the Opensource mailing list