aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes MainTain Session in swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "MainTain Session in swing" Watch "MainTain Session in swing" New topic
Author

MainTain Session in swing

johny sill
Greenhorn

Joined: Jul 08, 2006
Posts: 27
Hi,

How to maintain user session in swing,

I want to maintain session about user,

Thanks in advance

Bye
Aditya Jha
Ranch Hand

Joined: Aug 25, 2003
Posts: 227

I had developed a pattern for this. What you can use is a singleton object of a class encapsultaing java.util.Hashtable to act as session. Please note that this object could be singleton per JVM (if the app is running once only for one user) or singleton per user-frame (when the app is supposed to maintain several users at a time; although such situations will be rare).

You could also extend from Hashtable instead of encapsulating it to save on writing a number of wrapper methods, delegating individual tasks to the super class. However, encapsulating gives you one distinct advantage (particularly if you're not using Generics). You can statically decide on the data-type of keys and values in your session (String, String or String, Object etc.).

Think on these lines and post again if stuck somewhere.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MainTain Session in swing
 
Similar Threads
about user permission
How to maintain session in Swings application
How to invalidate a session in one browser when the same user login from any other browser?
What is user session management?
How to maintain Session in Swing application using StatefulsessionBean