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 Location of .tld file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Location of .tld file" Watch "Location of .tld file" New topic

Location of .tld file

Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
Dear All,
In head first, i have read that tld files must be inside WEB-INF/ or it's subdirectory. Or it must
be inside META-INF/ or it's subdirectory if it is bundled in jar. But when i move the same tld file
into application context directory and use taglib as follow-
<%@ taglib prefix="dyna" uri="/Test.tld"%>
It works fine.
How come rule to put tld into 'WEB-INF/ or it's subdirectory, META-INF/ or it's subdirectory' is broken and still things are fine.

Regards, Sharmila.
We will have a future if we save Nature!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Because you are being sloppy. The URI should be defined inside the TLD itself and should them be used to match the TLD, not the file path. That's rather fragile.

[Asking smart questions] [About Bear] [Books by Bear]
Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
I am wondering why the JSP would still like to employee the Tag file after it has already had the Custom Tag class and EL function.
I am still poor in the Tag file part of the objectives while heading SCWCD.

Sharmila Punde
Ranch Hand

Joined: Dec 26, 2007
Posts: 133
Dear Bibeault,
Thanks for your reply.
As per Head First, uri element is optional in '.tld' file. So if uri element is not mentioned in '.tld' file, then
uri attribute of taglib directive can take a path towards '.tld' file. But i was surprise to see it works fine even if '.tld'
file is NOT put into web_application_root/WEB-INF/ and IS PUT into web application root directory.
Thanks Zhixiong
I agree. Here's the link:
subject: Location of .tld file
It's not a secret anymore!