• 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

the order of XML tags in web.xml

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a feeling this is a stupid question...

In my book on the SCWCD i came across the following DTD(??)

<!ELEMENT web-app (icon?, ..., filter*, filter-mapping*,... servlet*, servlet-mapping*,...)>

My question is, must the filter tags always stand before the filtermapping... and those in turn be written before the servlet and servlet-mapping tags?

The reason of my question is that I get the following error messages from the servlet container (I think it is the container) when I place the filter tag after a servlet tag:

2005-jul-22 17:35:33 com.sun.enterprise.deployment.node.SaxParserHandler error
ALLVARLIG: "DPL8007: Invalid Deployment Descriptors in archive \E:\sun\samples\q
uickstart\hello3\ in deployment descriptor file WEB-INF/web.xml
Line 45 Column 11 -- The content of element type "web-app" must match "(icon?,di
splay-name?,description?,distributable?,context-param*,filter*,filter-mapping*,l
istener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-li
st?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,log
in-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". "
CLI171 Command deploydir failed : Deploying application in domain failed; Error
loading deployment descriptors for hello3 Line 45 Column 11 -- The content of e
lement type "web-app" must match "(icon?,display-name?,description?,distributabl
e?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,se
ssion-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-
ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,
ejb-ref*,ejb-local-ref*)".
; requested operation cannot be completed
 
author
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No such thing as a stupid question!

If your SCWCD book is talking about DTDs, then it is a little bit out of date. The current exam is pitched at J2EE 1.4, which uses a different method (called schemas - .xsd files) to validate XML configuration files, including the web deployment descriptor, web.xml.

The interesting thing is that for the schema for web.xml, the order of the top-level elements directly underneath <web-app> no longer matters. That said, for backward compatibility, I tend to keep things in the order that they were in in the servlet 2.3 DTD - in which case filters are declared before servlets. (Also, you do get local problems with servlet containers - Tomcat, for example, even in its latest version, will still choke if a <servlet-mapping> for a servlet comes before the corresponding <servlet> element).

I would suggest that you make sure you get to grips with servlet 2.4 deployment descriptors - how to declare them appropriately to validate against a schema. And make sure you have an up-do-date container (e.g. Tomcat 5) which supports J2EE 1.4.

Hope that helps -

Best,

David.
[ July 22, 2005: Message edited by: David Bridgewater ]
 
Kalle Anka
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx David for your fast reply! it really helped. And I also learned that it doesnt matters in the new schemas.

My book is brand new... It came out May 2005 I think (SCWCD exam study kit, Deshmukh et al). Its a really good one for someone just familiar with HTML and JavaScript. It actually both speaks of how to write web.xml with both DTD and schemas. But since the application server Im working on (the latest Orion) doesnt seem to support Servlet 2.4 nor JSP 2.0 (at least I doesnt get it to work) I choosed to continue working with the 2.3 DTDs.

thanx again!
 
David Bridgewater
author
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kalle...

You're welcome!

I would really recommend getting hold of Tomcat as well. It's free, very little trouble to set up, and supports J2EE 1.4 out of the box. Small download as well (you will need J2SE 1.4 as well, though, if you haven't got that already - but you probably do).

There are several topics in the current SCWCD where you need proper J2EE 1.4 support.

Best,

David.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic