× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



As long as that particular session is active you are
correct that you do not need to serialize anything
because you have your data stored as objects in the
session scope. But what happens if the user walks away
for lunch and his session times out? You would hope
that the last state of the user's session was somehow
saved in order to start him back up where he left off.
The two commonly used methods to do this are to either
store the data in a database, or to serialize the data
just prior to the session being invalidated. Then when
the user logs back on, your app can restore the data
from one of those.

Obviously, you're not going to serialize every
instance of a serializable class... only when you need
to. But in order to do so, you have to declare your
class as implementing the Serializable interface, or
as a sublass of something else that does so.

FYI - As mentioned previously, serializable has been
used for remote processing across separate JVMs, and
is  also used on occasion to clone objects. Cloning
objects in java can be a bit cumbersome sometimes,
especially with user defined objects. Serializable
allows for a quick & easy save/restore mechanism.

One word of caution though... serialized objects are a
potential security hole for hackers. Once the data is
serialized, it can be tampered with. So be careful
where you place it. 

Thanks,
Ivan Hurtado
 
--- Lim Hock-Chai <Lim.Hock-Chai@xxxxxxxxxxxxxxx>
wrote:

> Using shopping cart as an example.  I would think
> when I save the ordered Items to a session, I will
> save it as a Collection of those Item objects, which
> does not require Serialize (I don't think anyway).  
> 
> Can you give example?
> 
> -----Original Message-----
> From: java400-l-bounces@xxxxxxxxxxxx
> [mailto:java400-l-bounces@xxxxxxxxxxxx]On Behalf Of
> Ivan Hurtado
> Sent: Monday, December 20, 2004 9:45 AM
> To: Java Programming on and around the iSeries /
> AS400
> Subject: Re: Beginner java question: Serializable
> 
> 
> Common uses are...
> 
> 1) To save session data in order to be able to allow
> users to pick up where they left off. They may have
> been in the middle of some activity when they logged
> off (or if their session timed out) and the app can
> then use the serialized info to restore right back
> to
> where they were.
> 
> -- 
> This is the Java Programming on and around the
> iSeries / AS400 (JAVA400-L) mailing list
> To post a message email: JAVA400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit:
> http://lists.midrange.com/mailman/listinfo/java400-l
> or email: JAVA400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the
> archives
> at http://archive.midrange.com/java400-l.
> 
> 



                
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.