• 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

about listener  RSS feed

 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers
i attended this qn in mock exam i am confused with the answer

How do you declare listeners MyFirstListener and MySecondListener in web.xml file. (select one)




i thought the answer is A but the ansewr given is B . which one is correct.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is B exactly!
Because you can not write multi <listener-class> in a <listener> tag.
You have to separate them into two <listener> tag!
One <listener> tag have ONLY ONE <listener-class> tag.
 
Sundar Murthi
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But we can also set two or more listener in a single listener tag?

the two are valid can u able to conform to me


thanks
 
liny
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Sundar Murthi:
But we can also set two or more listener in a single listener tag?

the two are valid can u able to conform to me


thanks




Set two or more listener-class in a listener tag is useless.
Here is the web-app_2_3.dtd you can read.
You can find the "listener-class" in the web-app 2.3.
And it says "<!ELEMENT listener (listener-class)>".
That means one listener MUST and ONLY have ONE listener-class tag.
In my opinion, if you set more listener-class, Container will ignore second and others!

PS: in web-app_2_3.dtd
* means you can add this tag zero to many.
? means you can add this tag zero to one at most.
+ means you must add this tag one or more.
if there is no punctuation, it means you must add only one this tag.

If I am wrong, please tell me.
[ December 10, 2004: Message edited by: liny liny ]
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are right
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!