| Author |
about listener
|
Sundar Murthi
Ranch Hand
Joined: Mar 05, 2004
Posts: 209
|
|
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
Joined: Dec 08, 2004
Posts: 10
|
|
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
Joined: Mar 05, 2004
Posts: 209
|
|
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
Joined: Dec 08, 2004
Posts: 10
|
|
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
Joined: Apr 28, 2004
Posts: 41
|
|
|
you are right
|
 |
 |
|
|
subject: about listener
|
|
|