aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes short-name tag in TLD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "short-name tag in TLD" Watch "short-name tag in TLD" New topic
Author

short-name tag in TLD

Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
I am wondering whether the <short-name> element under the element <taglib> in JSP 2.0 is mandatory ?

Thanks for helping,
Adri

[ June 08, 2004: Message edited by: Adri Smith ]
[ June 08, 2004: Message edited by: Adri Smith ]
Sivasundaram Umapathy
Ranch Hand

Joined: Aug 10, 2002
Posts: 360
Yes it's mandatory. You can refer to page 3-16 of JSP 2.0 Specification where you can find short-name is defined as mandatory


Siva
Co-Author - SCMAD Exam Guide - ISBN:9780070077881
Author - Java certification success, Part 4: SCEA
Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
Thanks for you answer buddy
You are right the spec says it is mandatory.

Here is the "but" I tested it on tomcat 5.0 and it accepts the TLD without this tag so is it Tomcat not fully compliant with the spec :roll:

I am not so confident about the spec JSP 2.0. It seems to have some errors.
For example the jsp-version element is not mentionned on the drawing at the page 400 and it is mandatory !
Sivasundaram Umapathy
Ranch Hand

Joined: Aug 10, 2002
Posts: 360
What you are saying is true. Tomcat isn't 100% compatible to the specification. So it is always better to test in a different implementations. If you run the same code in resin, you get a error saying "short-name" is required. I personally use both tomcat and resin(which is very much compliant) to sort out these issues.

jsp-version was present in JSP 1.2's DTD. I don't see it in the schema definition of JSP 2.0. Now the version is an attribute of taglib element
Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
What is surprising is the behavior on Tomcat.

IT is not working if I do not put the tag <jsp-version>

and I tried with an attribute within the taglib element:

<taglib jsp-version="2.0">

It is raising an error
Error raised by Tomcat => "Mandatory TLD element missing or empty: jsp-version"

So what do you think ? is that Tomcat again not compliant or I make a mistake in the start tag of the element taglib.

Thanks,
Adri
Sivasundaram Umapathy
Ranch Hand

Joined: Aug 10, 2002
Posts: 360
Can you post the contents of your tld file please?
Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
Sure here it is:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib>
<tlib-version>1.0</tlib-version>
<display-name>arithmethic functions</display-name>
<jsp-version>2.0</jsp-version>
<function>
<name>addition</name>
<function-class>functions.FunctionArith</function-class>
<function-signature>
java.lang.Integer add(int,int)
</function-signature>
</function>
</taglib>
Sivasundaram Umapathy
Ranch Hand

Joined: Aug 10, 2002
Posts: 360
Can you start your tld as

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
version="2.0">
..rest of the tags ..

and try?
Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
Perfect it is working !

Thus we should put a version attribute and I used the syntax of the spec 2.3.

Thanks a lot,
this helping much,
Adri
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: short-name tag in TLD