Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TLD uri doubt

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given the TLD located at /mywebapp/WEB-INF/tlds/mytags.tld which would be the correct taglib directive ?
c) <%@ taglib uri="/WEB-INF/tlds/mytags.tld" prefix="my" %>
Explaination : In the absence of a <taglib> element in the DD, the uri must be a full path relative to the root context.

As far as i know, the TLD file MUST have a <uri> element.

Which all elements of a TLD are mandatory ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which all elements of a TLD are mandatory ?

Check the JSP specification
[ March 23, 2008: Message edited by: Christophe Verre ]
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried removing the <uri> element and it's working but according to HFSJ <uri> element is mandatory?
Why this contradiction ?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the JSP spec, the URI is optional.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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">

From Specs : taglib

description*,icon*,tlib-version,short-name,uri?,validator?,listener*,
tag*,tag-file*,function,description*,display-name*,icon*,tlib-version,short-name,uri?,validator?,listener*,tag*,
tag-file*,function*,taglib-extension*

Chistopes is right!!!
tlib-version,short-name are only mandatory elements...

One more query : does the sequence of these elements matters ?
Chistopes said in one of the posts that sequence of elements doesn't matter in case of web.xml. What about in TLD File?
Does by looking at xsd or dtd we can say whether sequence is required or not..

I am using eclipse and in that it shows sequence for taglib elements while it doesn't show for web-app elements...
This give me a hint that in xsd only we specify that whether the elements will come in sequence or not.

For web.xml ;
Content Model : (((description*, display-name*, icon*)) | distributable | context-param | filter |
filter-mapping | listener | servlet | servlet-mapping | session-config | mime-mapping | welcome-file-
list | error-page | jsp-config | security-constraint | login-config | security-role | ((env-entry*, ejb-
ref*, ejb-local-ref*, ((service-ref*)), resource-ref*, resource-env-ref*, message-destination-
ref*)) | message-destination | locale-encoding-mapping-list)*

NOTE: '|' -> I think it indicates no sequence

For .TLD File :

Content Model : (((description*, display-name*, icon*)), tlib-version, short-name, uri?, validator?,
listener*, tag*, tag-file*, function*, taglib-extension*)

NOTE : ',' : I think this means sequence is required..

Moreover i am using tomcat 5.5.17 and in tld i didn't specify <short-name>
it is still working. why ?

[ March 25, 2008: Message edited by: Sandeep Vaid ]

[ March 28, 2008: Message edited by: Sandeep Vaid ]

[ March 28, 2008: Message edited by: Sandeep Vaid ]
[ March 28, 2008: Message edited by: Sandeep Vaid ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic