Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Where to store "session" data

843810Mar 28 2005 — edited Mar 28 2005
I've done Web application programming using servlets/JSP, but I'm new to desktop programming. In Web apps you have this thing called the "Session" which represents one user's session of interacting with your app. You can store values in the "session". You could do this...
HttpSession session = request.getSession(true);
session.putValue("thisUser", s_username);
Then the user does a bunch of stuff and it's minutes later and you need that value again, you can do this...
s_username  = (String) session.getValue("thisUser");
My question is, what is the corresponding mechanism in desktop programming?

My thought was to use the main JFrame object to store data like that. Then as long as the app is running that JFrame exists in memory and I can update and retrieve those variables in response to user input.

Is that the way it's normally done? Or is there a better way?

Thanks,

E
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2005
Added on Mar 28 2005
2 comments
220 views