• 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

TLD question

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may seem ignorant but I'll ask anyway.
Sun's DTD has <!ELEMENT taglib (tlib-version, jsp-version ...
yet the correct syntax for TLD is "no dash" <tlibversion> or <jspversion>...what's the story here? This is according to Tomcat and even Sun's Taglib tutorial.
Thanks
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sun's DTD is @:
http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd
The no dash version is for jsp 1.1
In exam, they test jsp 1.2.
 
Gennady Shapiro
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<!ELEMENT taglib (tlib-version, jsp-version, short-name, uri?,
display-name?, small-icon?, large-icon?, description?,
validator?, listener*, tag+) >
what do you mean "no dash"? these dashes are all over.
 
Raj Kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gennady,
For jsp 1.1, we have:
<!ELEMENT taglib (tlibversion, jspversion?, shortname, uri?, info?, tag+) >
For jsp 1.1, we have:
<!ELEMENT taglib (tlib-version, jsp-version, short-name, uri?,
display-name?, small-icon?, large-icon?, description?,
validator?, listener*, tag+) >
In jsp 1.2, they added dashes all over the place!
 
Raj Kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops, 2nd reference is to jsp 1.2
 
Gennady Shapiro
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, well, Tomcat 4.0 claims to implement jsp 1.2 and still insists on "no dash" syntax.
I guess its a bug.
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess its a bug
Nope, thats a requirement.

- satya
Edited:
Section JSP.7.4, p117 of JSP Spec 1.2 Final Version -


TLDs in the 1.1 format must be accepted by JSP 1.2 containers.


See the keyword must......Fair enough?
- satya
[ February 20, 2002: Message edited by: Madhav Lakkapragada ]
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If i am not trying to confuse it a little more..
it all depends on the DTD u are referring to in your xml file.
If you have given the declaration like this,
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">..then you are following the 1.2 version.So you have to name the tags according to this DTD.But if you have referred to the 1.1 DTD then the web-container will tell you to declare the elements which confirm to the 1.1 DTD.
Hope this helps,
Manjunath
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
then the web-container will tell you to
errr....you are telling the web-container. So you better use the right tags.
There is no restriction on the web-container, it is required to support both. Its the choice of the developer to be consistent with the declaration in his/her TLD.
- satya
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Satya..
As i have learnt over these days from you that always try out with a code example before coming to a conclusion on these kinda topics, on which the books don't give u much info..
Well..u are right...
I tried an example where i referred to the 1.1 version DTD in the tld and used tags conforming to the 1.2 DTD.I dont have expert knowledge in XML,but this is slightly confusing to me..
Because an XML document with a DTD is said to be self-describing,how can something like that be said here where the xml tags confirm to a 'x' version but we are telling the web-container to look up a 'y' version DTD for the info on the tags even though the 'y' version is a higher version.
I don't think i have the previlege to say that this is wrong,but don't you think that this should not be the case..?
Thanks,
Manjunath
P.S: I wish Ajith gets involved here..
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how can something like that be said here where the xml tags confirm to a 'x' version but we are telling the web-container to look up a 'y' version DTD for the info on the tags even though the 'y' version is a higher version

IMO, the data is as self-describing as the developer wants it to be. If someone uses an x version DTD and uses y version elements, the info is no longer self-describing. You are violating the very assumption of using XML. Hence, the app - server fails to parse your (TLD) XML document.
- satya
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You said "IMO, the data is as self-describing as the developer wants it to be".
Can you elaborate on this point?
If i declare something like this..<x>10</x>
What is "10" describing"?Isn't it describing something with respect to the tag?
If the tags are named differently in two different versions of the DTD's shouldn't the values given to these tags be different?
I am kinda confused..Kindly bear with me
Manjunath
[ February 20, 2002: Message edited by: Manjunath Subramanian ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"10" is considered the body of element "x".
Depends on how "x" element is defined.
Lets take a practical approach here.......
Consider the "attribute" element of the "tag" element which started this discussion......
<attributte>
 <name>MyName</name>
 <required>true</required>
</attribute>
This piece of XML tells us that the attribute with a name "MyName" is required.
I know this because this is what the elements name and required mean in the context of the attribute element. How do I know this, the answer to that is the DTD I reference in my XML document (which is the TLD file). So according to the 1.2 version of the DTD for TLD's, the meaning of these elements is defined.
- satya
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gotcha Man..that's correct..!!
You said "Depends on how x is defined"...
That means that u agree with what i had said earlier regarding the DTD versions..right?
Manjunath
[ February 20, 2002: Message edited by: Manjunath Subramanian ]
 
Gennady Shapiro
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlibversion>1</tlibversion>
This TLD references 1.2 dtd...even though its titled "JSP Tag Library 1.1" and enforces 1.1 spec. (Tomcat)
I've solved the mistery.
#1. Sun has changed DTD URLS from http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_2.dtd to
http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd. But this is not the problem, this is irrelevant to the parser.
#2. You must change PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" to "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN". Then it enforces 1.2 spec.

what a pain.
 
Gennady Shapiro
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, just realized Manjunath has already pointed this out.
Thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

That means that u agree with what i had said earlier regarding the DTD versions..right?

First I din't realize you were testing me...
I think we are off track here.....Let me clarify.
I was picking on your stmt that
web container will tell you. Not on the stmt about DTD.

So you have to name the tags according to this DTD
Is a true stmt. I don't oppose this.
But if you have referred to the 1.1 DTD then the web-container will tell you to declare the elements which confirm to the 1.1 DTD.
This is what I would restate...If I were to say this I would do it in this fashion....
But if you have referred to the 1.1 DTD then it is your responsibility to declare the elements which confirm to the 1.1 DTD.
Hope I am clear. Sorry, if I stepped on your foot, din't mean to.
regds.
- satya
 
reply
    Bookmark Topic Watch Topic
  • New Topic