• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mandatory elemets in tld

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 8
Which of the following are mandatory elements of the tagLibrary descriptor file?
1) tlib-version
2) jsp-version
3) short-name
4) tag

Anwer 1,2,3,4
I think the answer is 1 , 2 only.
Question is from Eduardo Cobian
I have written lot of tags without short-name. And what if my tld has only el Functions and no tags and hence tag is also not mandatory.
So that answer is tlib-version and jsp-version is mandatory.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the spec talks that <short-name> is mandatory, But i have working tlds without <short-name/>
Any suggestions ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best and quickest way to check would be to look in the JSP specification. Answer is 1, 3.
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the spec
<!ELEMENT taglib (tlib-version, jsp-version, short-name, uri?, display-name?,
small-icon?, large-icon?, description?, validator?, listener*, tag+)


All three are mandatory
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verre

<!ELEMENT tag (name, tag-class, tei-class?, body-content?, display-name?,
small-icon?, large-icon?, description?, variable*, attribute*, example?) >

how is this possible body-content is optional. this is from jsp spec
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per the spec

You're looking at the wrong spec. There's no jsp-version tag in JSP2.0. You're probably looking at JSP1.2.
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide me the link
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please provide me the link

It's easy to find using Google, but even better is to bookmark this page: http://faq.javaranch.com/java/SpecificationUrls
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the JSP2.0 specification, look for "JSP.C.1XML Schema for TLD, JSP 2.0".
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the same document but please see the page 425 and 426.
is that dtd for which version?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Page 425 ? This is the old TLD : JSP.C.2DTD for TLD, JSP 1.2. Look at page 399.
 
Lakshmi Narayanan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
I have one more question

implict objects in JSP

request is javax.servlet.ServletRequest or javax.servlet.HttpServletRequest
I know HttpServletRequest extends ServleRequest
Please answer this
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Narayana,
This has nothing to do with Deepak's question. Please start your own thread.
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is the DTD of taglib
taglib
description*
display-name*
icon*
tlib-version
short-name
uri?
validator?
listener*
tag*
tag-file*
function*
taglib-extension*
Pg 3-24 "Figure JSP.C-1 TLD Schema Element Structure"
If
* === 0 or more
? 0 or 1
+ 1 or more
And few elements do not have anything. Which means they are mandatory.
1) jsp-version is not present in the above DTD. Does that means its not even valid element of a tld file.
2) short-name is mandatory, As i said am sure i have written tld without short-name and they worked great. So Am i missing something?

Please answer.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Yes
2) Your container might not bother about the short-name
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So am concluding
the mandatory elements of taglib are
tlib-version
short-name
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic