Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MainTain Session in swing

 
johny sill
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to maintain user session in swing,

I want to maintain session about user,

Thanks in advance

Bye
 
Aditya Jha
Ranch Hand
Posts: 227
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic