dcsimg
HttpSessionBindingEvent (Urgent Please)
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   krishna_venkata
Posted On:   Wednesday, March 6, 2002 07:48 PM

Hi, I read in the documentation that HttpSessionBindingEvent object is used to bound or unbound from a session. My doubt is .... Is this event fires automatically when the session expires or when the user closes the browser or when the user switch of the computer etc................... My problem is ................... Suppose user used my site 2 hours then i have to update the time in the database................... If user loged out properly then i am updating the database ....... If user closes the browser without logout or session expires or switch of the computer then how can i update time in the database........................    More>>

Hi,

I read in the documentation that HttpSessionBindingEvent object is used to bound or unbound from a session.


My doubt is ....


Is this event fires automatically when the session expires or when the user closes the browser or when the user switch of the computer etc...................



My problem is ...................



Suppose user used my site 2 hours then i have to update the time in the database...................


If user loged out properly then i am updating the database .......


If user closes the browser without logout or session expires or switch of the computer then how can i update time in the database........................


I am sure that this not possible with JavaScript............


What is the solution to solve this problem....................


Please can any one help to me........................


I have to solve this problem immediately..................


Is it possible by using HttpSessionBindingEvent..........



Thanks.

   <<Less

Re: HttpSessionBindingEvent (Urgent Please)

Posted By:   Mathias_Neuhaus  
Posted On:   Thursday, March 7, 2002 02:49 AM

Hi Krishna,

create a kind of "LoginBean", which has a method like login (user); and implements the Interface HttpSessionBindingListener.

When a user logs in, create an instance of this bean and store it in the session;
when the user logs out, remove the bean from the session. This will trigger a HttpSessionBindingEvent.

If you need to know the exact time of logout, you'll have to add a logout (); method to the bean and call that before removing the bean from the session. This method should update the time in the database.

The HttpSessionBindingListner has to check, whether a user is logged in; this will be the case when a session timeout occurs (logout (); wasn't called)!
(You can even subtract the session timeout from the actual time to get the point in time, where the user "lost interest".)
If no user is logged in, simply ignore the HttpSessionBindingEvent.

bis die Tage...
  Mathias

About | Sitemap | Contact