• 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

Servlet Sessions: putValue()

 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick question.
Must the object in

be a Serializable object? Jason Hunter says in Java Servlet Programming that

You can save any set of arbitrary Java objects in a session object.


If this statement is true, then why doesn't putValue()'s object have to be Serializable?
Thanks,
Art
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Art,
From Servet 2.2 spec

The main reasons for session objects must implement Serializable is, a good servlet container may choose to store the session objects to disk often to reduce the memory usage as well as to reduce the risk of losing the session objects in case of an emergency due to power failure/server failure etc.
regds
maha anna

[This message has been edited by maha anna (edited March 08, 2001).]
 
Art Metzer
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Maha Anna, that answers it beautifully.
By the way, and since I've got you, I wanted to thank you for your one-stop shopping (can I say that without paying Amazon?) with regards to the Sun Java Certification mock exams! Your efforts were a big help to me.
And thanks again for clarifying putValue().
Art
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Art! :-) The internet makes it possible. Isn't? One time effort helps many hundreds of people each day.
regds
maha anna
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic