Do we really have to follow this order in the deployment descriptor (web security)? <security-constraint> <login-config> <security-role> If yes, why?
Pradeep Chopra
Ranch Hand
Joined: Nov 19, 2000
Posts: 219
posted
0
Dear Allan, Here is the DTD for <web-app> element: <!ELEMENT web-app (icon?, display-name?, description?, distribut-able?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-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*)> The order in which sub-elements are there in DTD should be followed while writing DD file. Also note the meaning of following * : 0 or more occurence ? : 0 or 1 occurence + : 1 or more occurence | : means or if no symbol than mandatory with exactly one occurence I hope it helps. Thanks and regards Pradeep Java Certification Test Simulators � J@Whiz, SCWCD@Whiz http://www.whizlabs.com/jwhiz
The short answer is "yes", except that all three are optional :-) Why? ... because that's the order that the DTD specifies. Note that some app servers choose to be less strict about order, however Tomcat is not one of them.
Allan Moster
Ranch Hand
Joined: Sep 14, 2001
Posts: 153
posted
0
Essentially, what you're saying is we cannot deviate from this format?
Dave Vick
Ranch Hand
Joined: May 10, 2001
Posts: 3244
posted
0
Allan The short answer to your first question is: yes. The short answer to you second question is: because they said so. On a more serious note: I am by no means an XML guru, but my understanding is the whole point of it is to simplify and standardize a way to transmit information between two entities. The Deployment descriptor specifies the order in which the tags must come in order to simplify the communication. That way the a DTD I create will look the same and folow the same format as one that you create. It also allows the server to know exactly which tags are expected when and eases the parsing of the DTD by the server. hope that helps a little bit, I'm sure someone else knows a bit more on it and will add to this for you....
------------------ Dave Sun Certified Programmer for the Java� 2 Platform
Dave
Allan Moster
Ranch Hand
Joined: Sep 14, 2001
Posts: 153
posted
0
Hi Tim, I'm buying your answer that some app servers MAY not be strict on this order. Thanks.
Tim Duncan
Ranch Hand
Joined: Aug 20, 2001
Posts: 150
posted
0
Which is ok if you know where you're going to deploy, but bad practice if you want to remain portable.
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
posted
0
Yes, I work with WebLogic and it doesn�t complain about the order of the tags, at least some wich I�ve tryied, the most funny is that if you use the jsp compiler from WL it complains but you can run it and doesn�t have problems.
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
It depends mostly on the type of parser they are using for reading web.xml file. if you use validating parser then it definately complains about ur non-conformance. if you use non-validating (as the name suggests) it never cares about the ordering or cordinality/optionality of the attributes Sridhar
Originally posted by Marcos Maia: Yes, I work with WebLogic and it doesn�t complain about the order of the tags, at least some wich I�ve tryied, the most funny is that if you use the jsp compiler from WL it complains but you can run it and doesn�t have problems.
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
posted
0
yes, SridharS I agree, this behavior I�ve said is with the defaul configuration for WL6.0 and 6.1. regards. PS - You should change your name to match JavaRanch rules(or a sheriff will tell you to do so), take a look at: http://www.javaranch.com/name.jsp [This message has been edited by Marcos Maia (edited October 24, 2001).]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.