Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Listeners

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Which interface should be implemented by a class so that it's objects may receive notifications when they are put or removed from HttpSession?
The answer is HttpSessionBingdingListener.
What is de difference between HttpSessionAttributeListener and HttpSessionBingdingListener?
Thank you in advance.
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jordi
HttpSessionBindingListener has methods
valueBound(HttpSessionBindingEvent)
valueUnbound(HttpSessionBindingEvent)
So whenever an obj is being bound to a session, the notification comes thru this method.Similarly valueUnbound notifies if obj is unbound frm session.
faiza
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Faiza!
I know this, I think that my problem is that I don�t know the exact signification of bound because my english is not good. Can you explain me please?
Thank you.
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am just starting with this listener stuff. So I might be wrong.
Jordi: bind-bound-bound is like atar in my rusty spanish (you have a very catalan name). An object is bound (atado) to a session).
The important part of the question is:
it's objects may receive notifications . HttpSessionBindingListener is implemented by the object which is bound to the session.
HttpSessionAttributeListener listens globally about if an attribute has been removed or added from all the sessions.
Axel
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Axel, and yes I am Catalan form Barcelona
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, HttpSessionAttributeListener is configured in the deployment descriptor.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bottomline is who speaks and who listens....
HttpSessionBingdingListener: Session talks and the Class (implementing HttpSessionBingdingListener) listens.

HttpSessionAttributeListener: Application talks and Session object listens.
- satya
[ February 13, 2002: Message edited by: Madhav Lakkapragada ]
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool answer Satya..
 
You don't like waffles? Well, do you like this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic