This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mandatory elemets in tld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Mandatory elemets in tld" Watch "Mandatory elemets in tld" New topic
Author

Mandatory elemets in tld

Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
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.


SCJP, SCWCD, SCBCD
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
I think the spec talks that <short-name> is mandatory, But i have working tlds without <short-name/>
Any suggestions ?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The best and quickest way to check would be to look in the JSP specification. Answer is 1, 3.


[My Blog]
All roads lead to JavaRanch
Lakshmi Narayanan
Ranch Hand

Joined: Apr 29, 2008
Posts: 58
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


Thanks<br />Lakshmi<br />SCJP 1.4 - 90%<br />SCWCD 5 - 89%
Lakshmi Narayanan
Ranch Hand

Joined: Apr 29, 2008
Posts: 58
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Apr 29, 2008
Posts: 58
Please provide me the link
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41035
    
  43
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


Ping & DNS - my free Android networking tools app
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

In the JSP2.0 specification, look for "JSP.C.1XML Schema for TLD, JSP 2.0".
Lakshmi Narayanan
Ranch Hand

Joined: Apr 29, 2008
Posts: 58
I am using the same document but please see the page 425 and 426.
is that dtd for which version?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Page 425 ? This is the old TLD : JSP.C.2DTD for TLD, JSP 1.2. Look at page 399.
Lakshmi Narayanan
Ranch Hand

Joined: Apr 29, 2008
Posts: 58
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Narayana,
This has nothing to do with Deepak's question. Please start your own thread.
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

1) Yes
2) Your container might not bother about the short-name
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
So am concluding
the mandatory elements of taglib are
tlib-version
short-name
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mandatory elemets in tld
 
Similar Threads
what are mandatory elements in TLD?
Ques from Mock
mandatory elements of the tagLibrary
what is the correct answer..
mandatory tags in TLD