Taglibs (Sorted???)


2005-05-02 01:59:45 PM
jbuilder18
Hi all, I think I've got this sorted now. As I found it rather
vague from the documentation I could find I'll summarise here
so hopefully others can benefit.
Basically there are two ways to refer to a taglib and have it
found and use by your project:
1. By using an absolute URI within the taglib definition. For example, in the mytaglib.tld file you might have.
<uri>www.abc.com/taglibs/mytaglib</uri>
Because this is an absolute URI, JBuilder does not include the tld
files in your META-INF directory and does not add them to the
web.xml. When you refer to the taglib in your jsp pages using
<%@ taglib uri="www.abc.com/taglibs/mytaglib" prefix="mytl" %>
The jsp container looks through your included jars and finds the
first taglib that uses this URI.
This makes things simple and your web.xml file cleaner.
2. By using an relative URI within the taglib definition. For example, in the mytaglib.tld file you might have.
<uri>/META-INF/mytaglib.tld</uri>
In this case JBuilder will copy the tld file to the META-INF
directory and adds the reference to the web.xml. Then when looking
for the tld, the JSP container looks at the URI in relation to the
web site base directory and not in the jar files. The classes which
support the taglib can still remain in a jar as the container will
search the jars looking for them.
Does this sound correct to everyone ???
ciao
Derek.