Jakarta Taglibs is an open-source repository for JSP custom tag libraries and associated
projects. This project also hosts the development tree of the reference implementation (RI) for
the JSP Standard Tag Library (JSTL). This implementation is done under project standard.
Currently, no other tag libraries in Jakarta Taglibs represent Java Community Process
(JCP) standards.
The latest Jakarta Taglibs distributions can be downloaded from:
http://jakarta.apache.org/taglibs/
How to use a (custom) Tag Library in an application.
Information
none
Operating system used
Windows XP Home Edition Version 5.1 SP 2
Software prerequisites
none
Procedure
- Copy the library's JAR file {library}.jar to your web application
/WEB-INF/lib directory.
- Copy the Tag Library Descriptor {library}.tld file to your
web application /WEB-INF directory.
- Modify your web application deployment descriptor (/WEB-INF/web.xml) file to map the
Tag Library TLD URI to its location. For example:
<taglib>
<taglib-uri>/{library}</taglib-uri>
<taglib-location>/WEB-INF/{library}.tld</taglib-location>
</taglib>
or
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/{library}</taglib-uri>
<taglib-location>/WEB-INF/{library}.tld</taglib-location>
</taglib>
- To use the Tag Library in a JSP page, add the taglib directive <%@ taglib ... %>
at the top of the JSP page. This directive identifies the URI of the library you
want to use (which must match the value you specified in the <taglib-uri> element in
the web application deployment descriptor), and the tagname prefix you will use
within this page to identify tags from this library. The tag prefix is an arbitrary
choosen name but keep it as simple as possible.
<%@taglib uri="/{library}" prefix="x"%>
or
<%@ taglib uri="http://jakarta.apache.org/taglibs/{library}" prefix="x" %>
- To use one of the tags from this library, you would simply include it,
prefixed as you described in the taglib directive, and including attribute
names and values as described in the documentation for this tag library.
For example, if the library you are using has a tag named magic, and you selected
the "x" prefix as described above, you would might include this custom tag:
<x:magic/>
or, if this tag required attributes and perhaps some body text:
<x:magic id="beanName" name="xyz">
... Some body text and/or nested tags ...
</x:magic>
See the documentation provided with each custom tag library for detailed
descriptions of the available tags within that library.
|
|