• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

listener

 
Niu Xiuyuan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we define a lot listener classes in web.xml descriptor
lg.
<listener>
<listene-class>MySessionAttributeListener</listener-class>
</listener>
<listener>
<listene-class>MyContextAttributeListener</listener-class>
</listener>
my question is how do the server know which class is tied by listner class?
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, out on a little limb ....
The container uses the Java Reflection API. The relevant packages are java.lang.reflect and java.lang.Class.
The class is coded in web.xml.
The container looks at that and determines the interface which is implemented (not the class).
It thus knows what to call under what curcumstances.
G.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic