File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "taglib directive for tag files" Watch "taglib directive for tag files" New topic

taglib directive for tag files

Xiaoxiao Lam

Joined: Mar 04, 2006
Posts: 27
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:


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" %>
<%@taglib uri="myTagFile" %>

or neither of them are right? Thank you.

SCJP 1.4<br />SCWCD 1.4
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

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:
subject: taglib directive for tag files
It's not a secret anymore!