• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session vs class variables

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whatis the difference between session variables and using class variables? For exampe, if I have a class variable in my servlet that gets modified in the code, its new value gets carried to the next time the servlet is invoked. So why would I want to ever use a session variable if it seems the class variable holds data through various requests?
Thanks
Brian
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session variables are browser client - server specific, i.e for each and every session of the browser with the server u have a set of session variables at ur disposal.so one set of session variables for client session may have entirely different values from that of the other session values.
If we have the class variable in the server,then the value of the variable will be same for all the browser sessions.
Mainly session variable are used for security purpose,once the client server connection is lost session variables of that instance is also lost...
hope this answers the question,
reply
    Bookmark Topic Watch Topic
  • New Topic