File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about listener

 
Sundar Murthi
Ranch Hand
Posts: 209
  • 0
  • 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.
 
liny
Greenhorn
Posts: 10
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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 ]
 
Bianca Hagen
Ranch Hand
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are right
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic