• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Quick Question HttpSessionBinding vs HttpSessionAttribute Listeners

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between them?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like to implement HttpSessionBindingListener in an object that needs to save itself when a session is invalidated. We have an on-line exam that does that if the user is dropped or logged off before finishing so the test can be resumed.
Bill
 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
-binding- is implemented by the object which will
be set as session's attribute. it notifies this object when it is bound or unbound with a session.
(valueBound/valueUnbound methods...).
-attribute- is implemented by your servlet and throws an event when an object (attribute) is added, removed or replaced in session.
so, what makes the difference is the "side" you want to be notified about the event - does your object has to "know" it was addedor removedfrom a session or does your session has to " know" anattribute was added/removed/replaced in it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic