• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

HttpSessionBindingListener

 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is HttpSessionBindingListener interface ? Where is it used ?
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi Bharat,
HttpSessionBindingListener is an interface specifically used for session management.
If u want to know when the session is binded and unbinded, then u have to implement a class with this interface and use it in your servlet.
This interface has two methods 1) valueBound 2) valueUnBound
Implementing this two methods, u can do some useful work like whenever a session is binded, u can load the user related file in to memory and perform some actions on it, and when ever the session ends you can save the data back.
I hope u find this info useful.
bye.
Loke
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not entirely accurate
HttpSessionBindingListener is not so much about session lifetime as about the lifetime of session-scoped objects.
You can implement the HttpSessionBindingListener in any object you want to bind in the session. If you do, your object will be alerted when it is bound to a session, and when it is unbound for whatever reason (session expiration or a removeAttribute call).
This is useful if the object needs to do some initialisation or clean-up, such as managing external resources or the co-ordinated (un)binding of related session scoped objects.
- Peter
 
I want my playground back. Here, I'll give you this tiny ad for it:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic