IntelliJ Java IDE
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes listener Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "listener" Watch "listener" New topic
Author

listener

Niu Xiuyuan
Ranch Hand

Joined: Jun 08, 2001
Posts: 68
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?


Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
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.
 
 
subject: listener
 
Threads others viewed
Spring JSF integration doubt
how to register the listeners
Listener class problem
Execute jsp code automatically at startup of server
web application listeners
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture