aspose file tools*
The moose likes JSP and the fly likes serializable object in httpsession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "serializable object in httpsession" Watch "serializable object in httpsession" New topic
Author

serializable object in httpsession

Martin Lira
Ranch Hand

Joined: May 26, 2004
Posts: 97
Guys,
I have a webapp that stores an object (Ex. class Person:String first, last, dob, Address address, etc) in the httpsession. Is it required to make the object implement the serializable interface. I do not have a distributed system.

Are there any pros or cons if i make such objects serializable?

Thanks,
Martin
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The only harm in a non-distributed system is that your sessions won't persist over app restarts.

The app server will try to serialize the session object and all nested objects when the server shuts down. If any nested objects do not impliment serializable, the write fails.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: serializable object in httpsession