Home > Store > Programming > Java

Core JSTL: Mastering the JSP Standard Tag Library

Register your product to gain access to bonus material or receive a coupon.

Core JSTL: Mastering the JSP Standard Tag Library


  • Your Price: $39.99
  • List Price: $49.99
  • Usually ships in 24 hours.


  • Copyright 2003
  • Dimensions: 7 x 9 1/4
  • Pages: 608
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-100153-1
  • ISBN-13: 978-0-13-100153-4

The breakthrough solution for easier, faster, and more powerful Web development.

  • Powerful techniques for accelerating, simplifying, and standardizing Web application development
  • In-depth coverage of JSTL 1.0, including built-in tags, the new JSTL expression language, and custom tag development
  • Written for both experienced Java platform developers and Web page authors
  • By the best-selling author of Graphic Java and Advanced JavaServer Pages

Using JSTL, software developers and Web page authors can create robust, flexible Web applications more quickly and easily than ever before. Now, best-selling author and JSTL expert David Geary presents the definitive guide to JSTL: its built-in tags, powerful expression language, and extensibility. Through practical examples and extensive sample code, Geary demonstrates how JSTL simplifies, streamlines, and standardizes a wide range of common Web development tasks and helps you build Web applications far more easily than JavaServer Pages technology alone.

Key topics covered:

  • Building HTML forms; accessing form data, JavaBeans components (beans), collections, and maps; constructing URLs and importing their content; redirecting HTTP responses; iterating over collections of objects; handling errors
  • Localizing Web sites for multiple languages and countries, including localizing text and formatting and parsing numbers, currencies, percents, and dates.
  • Creating and accessing data sources, making queries and iterating over the results; performing database inserts, updates, and deletes; executing database transactions
  • Parsing XML documents; using XPath with JSTL custom actions; transforming XML with XSLT, filtering XML; accessing external entities

Core JSTL shows you how to:

  • Use JSTL to simplify Web development tasks
  • Use the new JSTL expression language
  • Access databases and execute transactions
  • Develop internationalized Web sites
  • Work with XML documents and JSP technology
  • Extend JSTL with custom tags


Source Code

Untitled Document

Download the Source Code related to this title.

Sample Content

Online Sample Chapter

The JSTL Expression Language

Downloadable Sample Chapter

Click here for a sample chapter for this book: 0131001531.pdf

Table of Contents



1. Introduction.

JSTL Overview. Getting Started. A Simple JSTL Web Application. JSTL Design Principles.

2. The JSTL Expression Language.

Expression Language Overview. Expressions. Identifiers. Operators. Type Coercion. Literal Values. Implicit Objects. Method Invocation. EL Expressions in Custom Actions. Common Mistakes.

3. General-Purpose and Conditional Actions.

General-Purpose Actions. Conditional Actions. Using Conditional and General-Purpose Actions Together. Conditional Custom Actions.

4. Iteration Actions.

The <c:forEach> Action. The <c:forTokens> Action. Iteration Status. Custom Iteration Actions.

5. Url Actions.

Overview. The <c:import> Action. The <c:redirect> Action. The <c:url> Action. The <c:param> Action. Accessing External Resources. Accessing Resources in Foreign Contexts. Redirecting a Response.

6. Configuration Settings.

Overview. The Config Class.

7. I18N Actions.

Overview. I18N and L10N. Localization Contexts. An Overview of the I18N Actions. Use of <fmt:message. Request Encoding. I18N Custom Actions.

8. Formatting Actions.

Formatting and Parsing Numbers. Formatting and Parsing Dates and Times. Using Time Zones. Determining a Formatting Locale.

9. Database Actions.

Overview. A Simple Database. How JSTL Locates Data Sources. Creating Data Sources. Querying a Database. Updating a Database. Executing Database Transactions. Implementing Database Custom Actions.

10. XML Actions.

A Simple XML File. XML Actions Overview. XPath Overview. Parsing XML. Using Scoped Variables in XPath Expressions. Transforming XML with XSLT. Filtering XML. Accessing External Entities.

11. JSTL Reference.

Action Reference Index. General-Purpose Actions. Conditional Actions. Iteration Actions. URL Actions. Internationalization Actions. Formatting Actions. Database Actions. XML Core Actions. XML Flow Control Actions. XML Transform Actions.

Appendix A. Setting Up The MySQL Database Used In This Book.

Download and Install MySQL. Download and Install a JDBC Driver for MySQL. Create a MySQL Database for Core JSTL Examples. Populate the MySQL Database Used in Core JSTL Examples.




Until recently, JavaServer Pages (JSP) has, for the most part, been accessible only to Java developers. That's because JSP did not provide a standard set of tags for common functionality or a scripting language for page authors. The lack of those essential features meant that JSP developers had to embed Java code in JSP pages or implement custom tags that encapsulated that Java code. Either way, they had to be well versed in the Java programming language to effectively use JSP.

To implement maintainable and extensible Web applications, developers must decouple business and presentation logic. Without an expression language or standard tag library, JSP pages often contained a great deal of Java code, which allowed easy access to business logic. That Java code and the inevitable related business logic tightly coupled JSP pages with the underlying data model, which resulted in brittle systems that were difficult to modify or extend.

The JSP Standard Tag Library (JSTL) provides a scripting language and set of standard tags that make JSP accessible to page authors and make it much easier to separate business and presentation logic. Those benefits allow page authors to focus on a Web application's presentation, while Java developers implement business logic, which in turn makes those applications much easier to implement, maintain, and extend. Because JSTL has such a profound effect on the development of Java-based Web applications as a whole, it is one of the most important new developments for server-side Java.

1.1 What This Book Is About

This book discusses all aspects of JSTL, including a thorough examination of the expression language and JSTL's tags (which are commonly known as actions). I assume that readers are already familiar with the basics of servlets and JSP, so those topics are not discussed in this book. See "This Book's Audience" for more information about what level of experience is assumed for readers.

1.2 The Servlet and JSP APIs This Book Depends Upon

JSTL only works with servlet containers that support the Servlet 2.3 and JSP 1.2 APIs. To run this book's examples, you will need such a servlet container; for example, Resin 2.1.2 or Tomcat 4.1.3; see "Downloading and Installing a Servlet Container" on page 26 for more information about downloading and installing those servlet containers.

1.3 The Book's Web Site

This book has a companion Web site at http://www.core-jstl.com. N.B. This is the correct URL. The one printed in the book is wrong. - Ed. That Web site provides documented source code for all of this book's examples.

1.4 How This Book's Code Was Tested

All of the code examples in this book were tested with Resin 2.1.2 and Tomcat 4.1.3. See "The Book's Web Site" for more information about downloading that code.

1.5 This Book's Audience

This book was written for Java developers with a basic understanding of servlets and JSP. If you are new to servlets and JSP, I recommend the following books for your first book on those topics:

  • Core Servlets and JSP by Marty Hall, Sun Microsystems Press
  • Advanced JavaServer Pages by David Geary, Sun Microsystems Press
  • Java Servlet Programming by Jason Hunter, O'Reilly
  • Web Development with JavaServer Pages by Fields and Kolb, Manning
1.6 How To Use This Book

The majority of this book is written in a tutorial style that illustrates how to make the most of JSTL's expression language and actions. The last chapter in the book is a reference for the JSTL actions. That reference provides detailed syntax information for each JSTL action, in addition to a short description of the action and its constraints and error handling. Each action also is accompanied by an In a Nutshell section that provides enough information about the action to get you started.

You can use the reference chapter in one of two ways. First, it may be a good place to start when you are using a JSTL action for the first time. Once you understand the action's syntax and its intent, you will probably want to read more about the action in the applicable chapter where it's discussed in detail. Second, you should use the reference to help you use JSTL actions after you understand their purpose and intent; for example, the <fmt:formatNumber> action, which is discussed in detail in "Formatting and Parsing Numbers" on page 310 and summarized in "Formatting Actions" on page 509 provides 12 attributes. It can be difficult to remember all of those attributes and how they work together. Instead of trying to unearth that specific information from the "Formatting Actions" chapter beginning on page 308, you would be better off looking up those attributes in the "JSTL Reference" chapter beginning on page 464.


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership