Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what are mandatory elements in TLD?

 
Will Lee
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of following are mandatory in TLD file?
a) tlib-version
b) jsp-version
c) short-name
d) tag
e) uri


I'm confused by answers from different source.
I remember HFSJ said a,c,e is required, but I did see many TLDs (maybe even HFSJ if I am right) don't include short-name;
Some other authors said they all are mandatory!! I can't agree with this, jsp-version is mandatory??

So what do you think?
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to tld from jsp spec tlib-version, jsp-version and short-name are mandatory.
Straight from jsp spec,
<!ELEMENT taglib (tlib-version, jsp-version, short-name, uri?, display-name?,
small-icon?, large-icon?, description?, validator?, listener*, tag+) >

from this i understand that tlib-version, jsp-version, short-name are mandatory. correct me, if i am wrong.
 
Will Lee
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you are right. jsp-version become required in JSP1.2.
The funny thing is the spec of JSP1.1 & 1.2 both states short-name as mandatory in [!ELEMENT...], however it didn't mention this in the following description. At least I only saw "This element is mandatory/required" for tlib-version and jsp-version.
 
Rohan Kayan
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok , It means answer for that question will be A,B,C and D.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Accoring to TLD XSD for JSP 2.0, only tlib-version and short-name is required.
tag and uri are defined optional and there is no jsp-version attribute in XSD for 2.0 as the taglib xml tag itself contain the version="2.0" mandatary attribute.

Thanks
 
Will Lee
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each version changes so much! What on earth is the answer?
In practice I wrote my own test TLD, w/out short-name, w/out jsp-version, it worked perfectly on tomcat5.5
It seems nothing is required!

What this exam tests? JSP1.2 or 2.0?
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The SCWCD 1.4 exam test JSP 2.0


In practice I wrote my own test TLD, w/out short-name, w/out jsp-version, it worked perfectly on tomcat5.5


Have to used the tags definded in test tdl ? The XML elements like web.xml, tlds are not validated at the time of creating the .war files or at deplyment time. But there is server error , if something goes wrong at run-time or simply ignored the un-wanted stuff.

If you are using any IDE to write your application, there is XML validation. It validate your XML against DD or XSD.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic