• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

Session management

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to maintain session in swing desktop application,
I want to store some data when login,I want to get this data anywhere in the application,
Right now I use system properties to set this login data,
May be due to this ,application slow sometimes,
Any body help me out,thankful
Posts: 833
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most real problems in programming boil down to live, visibility, and scope.  You are describing the grand problem of visibility.  If you have a controller or main class that launches all other classes and you make a data structure in that class, then when your start your application and instantiate your other objects, you will be able to reference that structure that stores the data you want--in other words all of your object will have visibility of that structure, because they are created in the same scope (class in this case) as the storage structure. Your storage object will then have life during the entire run of your program because your "main controller class" will need to be running during your entire session.

So, make a class, then define a structure to store your data as an instance variable--global variable with respect to your "controller class", and you'll have what you need.
Would you like to try a free sample? Today we are featuring tiny ads:
professionally read, modify and write PDF files from Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!