Chapter 23. Using the JSTL
Introduction
JavaServer Page’s custom tags and tag handlers are designed to help you invent your own tags. While this is a powerful tool for Java web developers, developing custom tags entails a steep learning curve and can be time consuming. Luckily, some hard-working volunteer software developers have developed a bunch of highly useful tags for you. This tag collection is called the JavaServer Pages Standard Tag Library (JSTL). The JSTL specification arises from the Java Community Process (JSR-052) and the Apache Jakarta Project has developed a JSTL implementation, the Standard 1.0 taglib.
The JSTL has very broad functionality. It includes tags that:
Set object attributes for web applications (
c:set).Output text to web pages (
c:outandx:out).Iterate over collections of data (
c:forEachandx:forEach).Format numbers, dates, and currencies using different international styles (e.g.,
fmt:formatDate,fmt:formatNumber).Transform XML (
x:transform).Interact with databases using SQL (e.g.,
sql:query,sql:update).Allow you to embed function calls in JSP code and template text (e.g.,
fn:substring( )). This functionality is available only with JSP 2.0 and JSTL 1.1 (see Recipe 23.14).
The JSTL originated a very important new JSP technology, the Expression Language (EL). This is a scripting language based generally on JavaScript and other scripting tools that, with JSP 2.0, can be embedded in HTML template text.
Tip
The EL was once part of JSTL 1.0 but ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access