Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Element ordering in DD


From Javaranch Mock exam

Ques
  <servlet>
          .........
  </servlet>


  <listener>
      <listener-class>com.javaranch.MockListener</listener-class>
  </listener>

The above entry in DD will result in what ?

Ans.

The webapp will not be loaded due to a parse exception of DD

The ordering of DD is listener then servlet

---------------------------

But i tried the following and it worked. There was no problem in loading the webapp

  <servlet>
      <servlet-name>A</servlet-name>
      <servlet-class>com.Abc</servlet-class>
  </servlet>

  <servlet-mapping>
     <servlet-name>A</servlet-name>
       <url-pattern>/MyServlet/*</url-pattern>
  </servlet-mapping>

  <listener>
      <listener-class>com.MyListener</listener-class>
  </listener>



PLease let me know whats the correct answer. Does ordering of XML elements in DD matter ?
0
thomas908
Asked:
thomas908
  • 2
  • 2
  • 2
1 Solution
 
bloodredsunCommented:
>>Does ordering of XML elements in DD matter ?

they do in servlet api 2.3 and lower but don't in api 2.4 so if you are running tomat 5, this will work fine, if you run tomcat 4 or lower then it will throw an error
0
 
CEHJCommented:
Too much like homework for comfort ...
0
 
thomas908Author Commented:
>> Too much like homework for comfort ...

This a ques from javaranch Mock Exam for SCWCD exam
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
thomas908Author Commented:
Thanks for helping, bloodredsun
0
 
bloodredsunCommented:
Glad to have helped.

You'll have to excuse CEHJ's comment as we are often asked to help people with their homework (CEHJ more than most as he is one of the best Java experts around EE, just have a look at his points) and I think he missed the part of your post where you stated that it was from the JavaRanch test (I used to take the JavaRanch tests too, it's nice to see a bit of humour in teaching!)
0
 
CEHJCommented:
>>You'll have to excuse CEHJ's comment as we are often asked to help people with their homework

8-)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now