Appendix C. JSTL Reference
The Java Standard Tag Library (JSTL) is a standardized collection of custom tags. It has a number of tags for common tasks such as iterating through lists, interacting with databases, handling XML data, formatting data, and much more.
The latest version of JSTL (at the time of writing) is 1.1. An implementation of JSTL can be downloaded from the Apache Jakarta Web site (http://jakarta.apache.org/
).
JSTL consist of four sets of tags and a library of functions, grouped according to their functionality:
JSTL core tags
JSTL XML tags
JSTL formatting tags
JSTL SQL tags
JSTL functions
JSTL Core Tags
The JSTL core tag library contains tags that deal with flow control in JSP pages, iterating over collections, evaluating expressions, and importing resources.
Before using the core tag library, the following directive needs to be added to the JSP page:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
The equivalent XML syntax for this directive is as follows:
<jsp:directive.taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" />
The following table summarizes the JSTL core tags.
Tag Name | Description |
---|---|
| Catches any |
| Provides conditional operation and allows for choosing between mutually exclusive options |
| Provides conditional operation |
| Imports a resource specified by a URL and exposes it to the page, variable, or reader |
| Iterates over collections |
| Iterates over tokens |
| Outputs expressions ... |
Get Beginning JavaServer Pages™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.