This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Quick Question HttpSessionBinding vs HttpSessionAttribute Listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Quick Question HttpSessionBinding vs HttpSessionAttribute Listeners" Watch "Quick Question HttpSessionBinding vs HttpSessionAttribute Listeners" New topic
Author

Quick Question HttpSessionBinding vs HttpSessionAttribute Listeners

Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 136
What is the difference between them?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 13000
    
    5
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
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
-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.


Asher Tarnopolski
SCJP,SCWCD
 
Have you checked out Aspose?
 
subject: Quick Question HttpSessionBinding vs HttpSessionAttribute Listeners
 
It's not a secret anymore!