This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes taglib directive for tag files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "taglib directive for tag files" Watch "taglib directive for tag files" New topic
Author

taglib directive for tag files

Xiaoxiao Lam
Greenhorn

Joined: Mar 04, 2006
Posts: 27
Hi,
I know if a tag file is not inside a jar, we don't need to make a TLD file for it and just use a "tagdir" attribute to describe the location of the tag file.

But when the tag file is inside a jar/META-INF and we have to make a TLD file for it. For example, if the TLD looks like this:

<taglib...>
<tlib-version>1.0</tlb-version>
<uri>myTagFile</uri>
<tag-file>
<name>Header</name>
<path>/META-INF/tags/Header.tag</path>
</tag-file>
</taglib>

In this case, when we want to use the the tag file in a jsp file, what does the taglib directive look like? Should we use the "tagdir" attribute or "uri" attribute?

Which one is right:
<%@taglib tagdir="/META-INF/tags/Header.tag" %>
or
<%@taglib uri="myTagFile" %>

or neither of them are right? Thank you.


SCJP 1.4<br />SCWCD 1.4
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You can only use the uri.
According to the spec, a translation error must occur if the value of tagdir does not start with /WEB-INF/tags/.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: taglib directive for tag files