Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

class implementing multiple listeners

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
how would one describe a class implementing multiple listner interfaces in the dtd of the application.. any ideas ..?
Cheers
taash
 
Ranch Hand
Posts: 5390
1
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you define only class name for listeners in dtd file, servlet container take care of finding the listeners and send appropriate events.
HTH
CMIW
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will the container use the same instance or it will instantiate a new object for each type of listener?
 
Author
Posts: 31
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container creates only one instance for each of the listener classes registered using the <listener> element. If such a class implements multiple listener interfaces, the container uses the same instance for notifying the events corresponding to all the interfaces that the class implements.
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you actually want to have separate instances, then you'll probably need to use the "empty subclass" technique:

So that the Servlet Container treats them as separate classes.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am not clear abt this empty sub-class technique. Why do we use it and what does it actually achieve? Though i agree with hanumant that only instance is create per listener tag in web.xml. If it implements multiple interfaces then it is automatically handled by the container.
Rajesh Kumar
SCJP2,SCWCD, UML(486), J2EE(483)
 
I think she's lovely. It's this tiny ad that called her crazy:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic