Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning Regular Expressions this week in the General Computing 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Listeners  RSS feed

 
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends

I know servlets to some extent but I am new to listener...My question is (may be very silly) if I want to add listeners to more than one event like ServletContextEvent and HttpSessionEvent and I have the listener classes in different files,then how can I declare both the classes in DD. Can I put 2 listener-class tags like



Or is there some other way?...Advance thanx...
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add as many as you'd like.
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but it should be

<!ELEMENT listener (listener-class)> *

u can have one and only one listener-class in listener.
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Bhumika, I couldnt understand what u r coming to say ...Can u explain with a piece of code?...
 
Bhumika Thakkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have 2 listeners mySessionListener and myContextListener then in DD u would declare them as

<listener>
<listener-class>mySessionListener</listener-class>
</listener>

<listener>
<listener-class>myContextListener</listener-class>
</listener>

Notice that we have 2 separate listener elements. Its not 2 listener-class in one listener element.

Hope this makes it clear.
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I understood..Thanx for ur reply...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!