posted 17 years ago
Suppose you have session and want to add an attribute to the session and before adding to session, if you want to do any work with an attribute, then you want listener (HttpSessionAttributeListener, which has three methods to be override attributeAdded(HttpSessionBindingEvent e),attributeRemoved(HttpSessionBindingEvent e),attributeReplaced(HttpSessionBindingEvent e)). Your code should go inside the attributeAdded(HttpSessionBindingEvent e)..
Like session to check any attribute are added/removed/replaced, you have for request and context (ServletRequestAttributeListener, ServletContextAttributeListener)
You have many listeners, but the basic idea is to do something when the desired event is triggered, which will be notified automatically by listener.
Since you have HFSJ, they given the example for ServletContext and HttpSession listerners..
May be this helps you..
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT