Dear Andrew, I keep the Vector of sessions in servlet. I tried to do the next: when any session times out (it becomes invalidate) - remove it from the Vector. Would you be so kind to help me to apply HttpSessionBindingEvent ,HttpSessionBindingListener? Thank you in advance. Best Regards, Eugene. > -----Original Message----- > From: Andrew Beacock [mailto:[EMAIL PROTECTED]] > Sent: m/9/00 07:59 AM > To: [EMAIL PROTECTED] > Subject: Re: How to use HttpSessionBindingEvent? > > > Phil, > > > Could anybody give me a simple code example to show me how to use > > HttpSessionBindingEvent,HttpSessionBindingListener? > > I couldn't find a tutorial on that topic, thanks > > It very simple, just implement the HttpSessionBindingListener and > Serializable (required for session binding), then code as > follows in you > object; > > <code> > > import javax.servlet.http.*; > > public class BoundObject implements Serializable, > HttpSessionBindingListener { > private String something = null; > > public BoundObject (String something) { > this.something = something; > } > > public otherMethod () { > ... > } > > ... > > /** > * this is the bound method that you have to implement defined in > the interface > */ > public void valueBound (HttpSessionBindingEvent event) { > System.out.println (toString () + ".valueBound: I've > been bound > to \"" + event.getName () + "\" for session id: " + (event.getSession > ()).getId ()); > } > > /** > * this is the unbound method that you have to implement > defined in > the interface > */ > public void valueUnbound (HttpSessionBindingEvent event) { > System.out.println (toString () + ".valueUnbound: I've been > unbound from \"" + event.getName () + "\" for session id: " + > (event.getSession ()).getId ()); > } > } > > </code> > > The session.putValue () ends up calling the valueBound () method, and > the session.invalidate () calls the other one. > The servlet container should always send the unbound event > when it times > out the session. > > Hope this helps, > > Andrew Beacock > Software Team Leader > InterVoice-Brite Ltd. > > ______________________________________________________________ > _____________ > To unsubscribe, send email to [EMAIL PROTECTED] and > include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: > http://java.sun.com/products/servlet/external-> resources.html > > LISTSERV Help: > http://www.lsoft.com/manuals/user/user.html > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
