aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes About listner entry in the DD??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "About listner entry in the DD???" Watch "About listner entry in the DD???" New topic
Author

About listner entry in the DD???

Amitkumar Dhama
Ranch Hand

Joined: Feb 14, 2005
Posts: 56
Hi all this is Amit, I got this question from one of the mock exam...
Consider the following DD entry....

<web-app.....>
<servlet>
............
</servlet>
<listner>
<listner-class>com.mylistners.loglistner</listner-class>
</listner>
</web-app>

based on the above entry what will be the result....

The Correct answer is "parse exception".....

can anybody explain me why is it giving parse exception?
In the headfirst's Attribute and listner chapter DD is given like this one only..


Does the location of llistner entry in the DD matters and, if so where it should be???

Thanking in advance.......


SCJP 1.4, SCWCD 1.4, M.Tech(CSE)
Balasubramani Dharmalingam
Ranch Hand

Joined: Dec 06, 2004
Posts: 116
It wont throw parse exception. It is the correct way to declare the listeners.
where u got this question..?


Balasubramani SD,<br />SCJP 1.4,SCWCD 1.4,SCJP 5.0<br /><a href="http://sd.balasubramani.googlepages.com" target="_blank" rel="nofollow">www.sd.balasubramani.googlepages.com</a>
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
<listner>
<listner-class>com.mylistners.loglistner</listner-class>
</listner>

that should be listener


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Amitkumar Dhama
Ranch Hand

Joined: Feb 14, 2005
Posts: 56
This question is given in javaranch mock exam i forgot the question ID....

the question was same..

Does the location of the listner entry in the DD matters...

and when will it throw an parse exception??? Please let me know...

Thanking in advance...
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi Amit,

The JavaRanch exam is based on old spec J2EE 1.3. So the DD for this spec require specific order of sub-elements. That is the listener definations should come before servlet definations. That is why the parse error. For J2EE 1.4 there is order restrictions for sub-elements of <web-app>

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
Kuppusamy Venkatasubramanian
Ranch Hand

Joined: Dec 30, 2004
Posts: 91
Hi Narendra,

"For J2EE 1.4 there is order restrictions for sub-elements of <web-app>"
Did you mean
"For J2EE 1.4 there is NO order restrictions for sub-elements of <web-app>"?

SAM


SCJP1.4, SCBCD 1.3, SCWCD 1.4, SCEA 5, JLPT-N3
My Blog
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

Sorry, That is typo. For J2EE 1.4 there is NO order restrictions for sub-elements of <web-app>. But there is order restrictions for sub-element under subelements of <web-app>

Thanks
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Yes. Thats what Narendra intended.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Vineela Devi
Ranch Hand

Joined: Dec 20, 2003
Posts: 191
Hi Narendra,

I have tried interchanging thr order of sub-elements of sub-elements of web-app.It didnt give me any problem.

I have tried this:

<servlet>
<servlet-class>com.example.xxx</servlet-class>
<servlet-name>testOrder</servlet-name>
</servlet>

and its working fine.

Iam using Tomcat5.5

Please clarify.

Vineela
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi Vineela,

I have tried interchanging thr order of sub-elements of sub-elements of web-app.It didnt give me any problem.


I think we have discussed little bit on this in your previous post.

I also created a sample application by interchanging the order of sub-elements of sub-elements of web-app. The .war I deployed in tomcat 5.5.7. It is working fine. But When I tried to deploy on Java Application Server8.1 UR2 it doesn't allow me to deploy the .war due to this interchanging.

The specification clearly says that such interchaging is not allowed (error). and the Reference implementation of Java Application Server8.1 UR2 behaves the same. So the exam point of view, we should consider that the order of sub-elements of sub-element of <web-app> is important.

I am using NetBean IDE to test the web.xml. It also give the XML validation error, if I try to validate the web.xml file.

Correct me, if my assumption is not right.

Thanks
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

The specification clearly says that such interchaging is not allowed (error)


I like to know the page number of the spec.

From Spec


The sub elements under web-app can be in an arbitrary order in this version(2.4 of the specification.


Nothing has been mentioned about the order of sub-elements of sub elements under web-app element.

This can be conformed under a high-end application server like weblogic (or) websphere.
[ November 22, 2005: Message edited by: Vishnu Prakash ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About listner entry in the DD???