Nicolas Pujol wrote:
> Is there any possibility for one Bean to expire before other Beans?
>
> It appears to me that it should not be possible, since it is the session
>
> that expires and not the Beans. I want to make sure that it is good
> enough for me to check for the existence of one Bean in order to insure
> that other ones exists (granted I have created them somewhere). Can
> anything happen in the JVM that would somehow invalidate a Bean and
> remove it from the session ?
>
> Please give me your thoughts!!
>
> Nicolas
>
Beans do not expire, and they do not get invalidated. Those concepts apply
only to sessions. The only thing that the servlet engine will do to user
data objects associated with a session is to remove them from the session
when it is invalidated (either because it timed out, or because you called
invalidate() yourself).
However, your servlet or JSP code can remove a bean from a session any time
it wants to:
session.removeValue("TheKey");
Likewise, if you call something like
session.putValue("TheKey", aNewObject);
and there was a previous object bound to that key, the previous object is
removed.
If your bean itself wants to know when it is being added to, or removed from,
a session, have it implement the HttpSessionBindingListener interface. See
the servlet API specs (and API docs) for more information about this.
Craig McClanahan
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".