The Web container creates an instance of each listener class and registers it for event notifications prior to the processing of the first request by the application. The Web container registers the listener instances according to the interfaces they implement and the order in which they appear in the deployment descriptor. During Web application execution, listeners are invoked in the order of their registration.
In the statement in bold, I understood that listeners are registered in order in which they appear in DD, but what is exactly meant by registration accd to interfaces they implement ??
and in dd we declare
Now order of creation of instance of classes is LisitenerclassB ,LisitenerclassA.
and then order of registration of classes for events are LisitenerclassB regstrd against HttpSessionAttributeListener LisitenerclassB regstrd against HttpSessionBindingListener LisitenerclassA regstrd against HttpSessionAttributeListener LisitenerclassA regstrd against HttpSessionBindingListener .
So a HttpSessionAttribute event [replace an attribute including a binding event]occur LisitenerclassB will be notified 1st and method invocation will be in the order attributeReplaced,valueBound- means in the order in which interface is been regstrd.
Kamal Tripathi wrote:On the same lines I wanted to ask if in a webapp's DD I configure an HttpSessionAttributeListener and also define a class A implementing HttpSessionBindingListener interface.