• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Order of elements in the DD- web.xml file

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that the order of tage in the DD web.xml is order specific.
I read somewhere that the following order be followed: filter, listeners, servlets and their mapping, session-config, welcome-file-list etc

But, surprisingly the listener tag is working fine even ferore servlet and server-mapping elemnets and also after them. How can this be true?

Any help shall be highly appreciated.
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deployment descriptor elements are in order. For version 2.3, order is

<!ELEMENT web-app (icon?, display-name?, description?,
distributable?, context-param*, filter*, filter-mapping*,
listener*, servlet*, servlet-mapping*, session-config?, mimemapping*,
welcome-file-list?, error-page*, taglib*, resourceenv-
ref*, resource-ref*, security-constraint*, login-config?,
security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>

Are you validating your descriptor file against dtd file?
If you use any IDE and mentioned your listener element after servlet element, you will see error message.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It also depends upon what version of the Servlet Specification your deployment descriptor is using. The ordering rules of elements using the Servlets 2.3 DTD will be different than using the Servlets 2.4 XML Schema.
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear/Mukesh,
Thanks for posting your comments.

Mukesh, I have also tried the same web.xml file with Eclipse 3.2 with a Tomcat plugin. But still, I don't get to see any error message on the console.

Bear, I'm, using jakarta-tomcat-5.0.28 which I believe implements Servlet 2.4 Spec.

I still have no clue that even if I move the listener tag after servlet definition and mapping, I don't get to see any error message.

Thanks,
Reema
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reema Patel:
Bear, I'm, using jakarta-tomcat-5.0.28 which I believe implements Servlet 2.4 Spec.



It can, but that's moot if you continue to use the 2.3 DTD in your deployment descriptor.
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,
Thanks for the post.

I belive that the DTD description goes in the beginning of a standard DD-web.xml file. Following is an element from the web.xml file I'm using:



I think this is using Servlet spec 2.3 and that might be the reason I'm not getting to see any error on the console when I put a listener element before a servlet/servlet-mapping element.

I also tried to replace the digit- 3 with 4, but it throws the following error on the console when Tomcat is started:


Could you please guide me on this.

Regards,
Reema
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you read my first post in this topic, you will have noted that Servlets 2.4 does not use a DTD; it uses an XML Schema.

You can find the correct syntax in the Servlet Specification. You do have it handy on your desk, don't you?
 
Reema Patel
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,
Thanks for posting again!


If you read my first post in this topic, you will have noted that Servlets 2.4 does not use a DTD; it uses an XML Schema


What's the difference between a DTD and an XML schema.My apologies, if i'm sounding too novice here.

In short, how can I get to see the error message on the console window if I precede servlet or servlet-mapping element(s) before the lostener element? I'm using jakarta-tomcat-5.0.28 and, have already posted the contents of web.xml file?

Any help shall be highly appreciated.
Thanks,
Reema
 
Mukesh Mittal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think everything is depends on your servlet conatiner. I am using websphere and getting error with servlet 2.3

If you move your listener element after the servlet then you will get error message.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reema Patel:

What's the difference between a DTD and an XML schema.



It might be helpful if you could do some research on your own.

DTD

XML Schema
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Reema Patel:

What's the difference between a DTD and an XML schema.



It might be helpful if you could do some research on your own.

DTD

XML Schema
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic