[ Team LiB ] |
![]() ![]() |
Recipe 23.1 Downloading the JSTL 1.0 and Using the JSTL Tags in JSPsProblemYou want to download and use the JSTL. SolutionDownload the JSTL distribution, in a ZIP or TAR file, from the Apache Jakarta Project. DiscussionThe Apache Jakarta Project hosts the reference implementation (RI) for the JSTL. An RI is software that is designed to implement a particular Java technology specification in order to demonstrate how the software is intended to function. RIs are freely available for use by software vendors and developers. You can download the binary or source distribution of the JSTL from http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html. Unpack the ZIP or TAR file into the directory of your choice. This creates a jakarta-taglibs directory.
Inside the standard-1.0.3 directory is a lib subdirectory. This directory contains a number of JAR files, including jstl.jar and standard.jar. The jstl.jar contains the JSTL 1.0 API classes; standard.jar is a collection of JSTL 1.0 implementation classes. Add all of the JAR files found in your JSTL distribution's lib directory (jakarta-taglibs/standard-1.0.3/lib in the example) to WEB-INF/lib.
Table 23-1 describes each of the JAR files found in the distribution's lib directory (courtesy of the Standard Taglib 1.0 documentation).
In the JSP where you want to use the JSTL tags, use the proper taglib directive shown in Table 23-2. For example, if you use all of the different JSTL functions (core, XML, formatting, and SQL), your JSP contains all of the following taglib directives, preferably at the top of the JSP page (they must appear before the tags are used).
See AlsoThe Jakarta Project's Taglibs site: http://jakarta.apache.org/taglibs/index.html; Sun Microsystem's JSTL information page: http://java.sun.com/products/jsp/jstl/; Recipe 23.3 on using the core tags; Recipe 23.4 and Recipe 23.5 on using XML-related tags; Recipe 23.6 on using the formatting tags; Recipe 23.7 and Recipe 23.8 on the JSTL's SQL features; Recipe 23.9-Recipe 23.14 on using the EL to access scoped variables, cookies, and JavaBean properties. |
[ Team LiB ] |
![]() ![]() |