JSTL - 1st Edition - ISBN: 9780126567557, 9780080495965


1st Edition

Practical Guide for JSP Programmers

Authors: Sue Spielman
eBook ISBN: 9780080495965
Paperback ISBN: 9780126567557
Imprint: Morgan Kaufmann
Published Date: 22nd August 2003
Page Count: 229
Tax/VAT will be calculated at check-out
20% off
20% off
30% off
30% off
30% off
30% off
30% off
20% off
20% off
30% off
30% off
30% off
30% off
30% off
20% off
20% off
30% off
30% off
30% off
30% off
30% off
20% off
20% off
30% off
30% off
30% off
30% off
30% off

Easy - Download and start reading immediately. There’s no activation process to access eBooks; all eBooks are fully searchable, and enabled for copying, pasting, and printing.

Flexible - Read on multiple operating systems and devices. Easily read eBooks on smart phones, computers, or any eBook readers, including Kindle.

Open - Buy once, receive and download all available eBook formats, including PDF, EPUB, and Mobi (for Kindle).

Institutional Access

Secure Checkout

Personal information is secured with SSL technology.

Free Shipping

Free global shipping
No minimum order.

Table of Contents


1 Introduction

1.1 What Exactly Is the JSTL?

1.2 Why a JSP Standard Tag Library?

1.3 Why Now?

1.4 Why You Really Want to Use the JSTL

1.5 The Need for Encapsulation

1.6 Functional Overview

1.7 JSTL Tag Libraries

1.8 Getting Ready to Use the JSTL

1.9 The Road to the JSTL

1.9.1 Dynamic vs. Static Content

1.9.2 Using Dynamic Content

1.9.3 Using Dynamic Web Features

1.9.4 Server-Side Processing

1.10 Servlets to the Rescue

1.11 Hello My Friend Servlet

1.12 JavaServer Pages

1.13 When a JSP, When a Servlet?

1.14 Evolving JSP

1.15 Custom Actions in Action

1.15.1 Why Use a Custom Action

1.15.2 Hello My Friend Using Custom Actions

1.15.3 The TLD File

1.15.4 The Tag Handler

1.16 The Power of Tag Libraries

1.16.1 Need for a Tag Library

1.17 Making Life Easier, JSTL in Action

2 JSTL Basics

2.1 Environment Setup

2.2 Using the Book Examples

2.3 JSP Scopes

2.4 JSTL Scoped Variables

2.4.1 Var and Scope Attributes

2.4.2 Variable Visibility

2.5 Dynamic and Static Attributes

2.6 Handling Errors and Exceptions

2.7 Action Body Content

2.8 Configuration Settings

2.9 The Config Class

2.10 Summary

3 Using the Expression Language

3.1 Implicit Objects Available in the EL

3.2 Accessing Data Structures

3.3 EL Operators

3.3.1 Relational Operators

3.3.2 Other Operators

3.3.3 Using Operators

3.4 Automatic Type Conversion

3.5 Default Values

3.6 Summary

4 Working with the Core Actions

4.1 Writing Output to the JspWriter

4.2 Setting Variables

4.3 Removing Variables

4.4 Using

4.4.1 Handling Exceptions

4.5 Decisions, Decisions, Decisions—Conditional Actions

4.5.1 Simple Conditional

4.5.2 Mutually Exclusive Conditionals

4.5.3 Creating Custom Logic Actions

4.6 Handling Iterators


4.6.2 Paging through a Large Collection

4.6.3 Looping with a Collection

4.6.4 Tokenizing Data Using

4.7 URL-Related Actions



4.7.3 Creating and Using Dynamic Links



4.8 Untangling the Web We Weave

4.8.1 The Power of

4.8.2 and the Composite View Pattern

4.8.3 Storing Imported Content

4.8.4 Using Character Encoding

4.9 Redirecting

4.10 Summary

5 Working with the XML Actions

5.1 Overview of Supporting Technologies

5.2 eXtensible Markup Language (XML)

5.2.1 Using XML Files for Data Storage

5.2.2 XML APIs

5.3 eXtenstible Stylesheet Language (XSL)

5.3.1 Allowing for Transformation

5.3.2 XSL Languages

5.4 XML Path Language (XPath)

5.4.1 Library Functions

5.5 Variable Mappings

5.6 Using the Select Attribute

5.7 Accessing Resources

5.7.1 Node Types

5.7.2 Node Functions

5.8 eXtensible Stylesheet Language Transformation (XSLT)

5.8.1 XSLT Namespace

5.9 Parsing XML Documents

5.9.1 Action

5.9.2 Filtering

5.9.3 Using the Advanced Attributes

5.10 Using and

5.10.1 Action

5.10.2 Action

5.11 and in Action

5.12 Using XML Documents to Determine Flow Control

5.12.1 Action

5.12.2 Using

5.12.3 , , and Actions

5.13 Going Loopy with

5.13.1 Nested forEach Loops

5.14 XML Transformation Actions

5.14.1 Action

5.15 Transforming Content

5.16 Providing Parameters to Transformations

5.16.1 Action

5.16.2 Performing Multiple Transformations

5.17 Summary

6 Working with the Internationalization and Formatting Actions

6.1 Locales

6.1.1 Internationalization vs. Localization

6.2 Why be Language Independent?

6.3 Localizing an Application Using Resource Bundles

6.4 Types of I18N Architectures

6.5 First, the Action

6.6 Localization Context

6.7 Localization Context Sample

6.8 Preferred Locales

6.8.1 Setting the Preferred Locales

6.9 Formatting Locales

6.10 How Resource Bundles are Decided

6.10.1 Resource Bundle Lookup Differences

6.11 Resource Bundle Lookup Samples

6.12 Using the LocaleSupport Class

6.13 Setting and Using Locales

6.13.1 Action

6.13.2 Having a Fallback Locale

6.14 Using Messages and Resource Bundles

6.14.1 Action

6.14.2 Action

6.14.3 Action

6.14.4 Action

6.15 Setting the Resource Bundle for

6.16 Adding a parameter to

6.17 Formatting Actions

6.17.1 Determining the Time Zone

6.17.2 Action

6.17.3 Action

6.18 Setting and Using Time Zones

6.19 Working with Timestamps

6.20 Formatting and Parsing Timestamps

6.20.1 Action


6.20.3 Customizing the Format

6.21 Using and Parsing Timestamps

6.22 Working with Numbers

6.22.1 Action

6.22.2 Action

6.22.3 Formatting Numbers

6.22.4 Parsing Numbers

6.23 Encoding the Client Response

6.24 Summary

7 SQL Tag Library Using the SQL Actions

7.1 The Available Actions

7.2 Working with the Data Source


7.3 Configuring a Data Source

7.4 Using a Data Source

7.5 Maxrows Configuration Setting

7.6 Configuring and Using a Data Source

7.7 How to Modify Data

7.7.1 Action

7.7.2 How to Use var with

7.8 Interfaces and Classes

7.8.1 Result Interface

7.8.2 SQLExecutionTag Interface

7.8.3 ResultSupport Class

7.9 Finding What You Need with

7.9.1 Action

7.10 Passing Parameters to SQL Statements

7.10.1 Dealing with Date Parameters

7.11 Working with Result Sets

7.11.1 Accessing Rows and Columns

7.11.2 Using Result Set Metadata

7.12 Dealing with Transactions

7.12.1 Words of Caution

7.13 Action

7.14 How to Use

7.15 Summary

7.16 Conclusion

8 JSTL Quick Reference

8.1 Expression Language Syntax

8.1.1 Literals

8.1.2 “[]” and “.” Operators

8.1.3 Arithmetic Operators

8.1.4 Relational Operators

8.1.5 Logical Operators

8.1.6 Empty Operator

8.1.7 Operator Precedence

8.1.8 Reserved Words

8.1.9 Coercion Rules

8.1.10 Accessing Named Variables

8.1.11 Implicit Objects

8.2 Configuration Settings

8.3 Core Tag Library

8.3.1 Tag Library URI

8.3.2 General Purpose Actions

8.3.3 Conditional Actions

8.3.4 Iterator Actions

8.3.5 URL Related Actions

8.4 XML Tag Library

8.4.1 Tag Library URI

8.4.2 XML Core Actions

8.4.3 XML Flow Control

8.4.4 Iterator Actions

8.4.5 Transformation Actions

8.5 SQL Tag Library

8.5.1 Tag Library URI

8.5.2 Actions

8.6 I18N Tag Library

8.6.1 Tag Library URI

8.6.2 Internationalization Actions

8.6.3 Formatting Actions



Web developers and page authors who use JavaServer Pages (JSP) know that it is much easier and efficient to implement web pages without reinventing the wheel each time. In order to shave valuable time from their development schedules, those who work with JSP have created, debugged, and used custom tags—a set of programmable actions that provide dynamic behavior to static pages—paving the way towards a more common, standard approach to using Java technology for web development. The biggest boost to this effort however has only recently arrived in the form of a standard set of tag libraries, known as the JSTL, which now provides a wide range of functionality and gives web page authors a much more simplified approach to implementing dynamic, Java-based web sites.

JSTL: Practical Guide for JSP Programmers is a timely resource for anyone interested in doing large-scale J2EE application development. It sticks to the main features of the JSTL so that developers don't have to sift through unnecessary details to begin using the tags and working with the expression language. Sue Spielman's straight-forward, practical approach is enhanced with numerous code samples and insightful descriptions to make learning the JSTL a quickly and easily accomplished task.

Key Features

  • Written by a best-selling author with a wealth of development experience and recognition in the Java community.
  • Covers the core elements of the JSTL including the four standard tag libraries (core, internationalization/format, XML, and SQL) and expression language.
  • Includes a reference section for all of the tabs and attributes contained in the JSTL.


Java developers and programmers, specifically those doing presentation-level J2EE development.


No. of pages:
© Morgan Kaufmann 2004
Morgan Kaufmann
eBook ISBN:
Paperback ISBN:


An invaluable reference for any JSP developer's library. Sue makes the complicated seem simple with her conversational writing style and well thought out examples and analogies. -Matt Houser, J2EE Developer with The Washington Post and former Sun Microsystems Java Instructor.

About the Authors

Sue Spielman Author

Sue Spielman has over 15 years hands-on experience delivering leading edge technology products. She has been working with Java ever since it was born. Sue is the President and Senior Consulting Engineer of Switchback Software LLC (www.switchbacksoftware.com) a consulting firm that specializes in business and web application development and deployment using the latest in J2EE & J2ME technologies. She is the JSP/Servlet columnist for OnJava.com and a recognized Java expert appearing in industry magazines including JavaPro, XML, and Devx.com. Sue is a featured speaker on various Java technologies at conferences throughout the United States and abroad.

Affiliations and Expertise

Switchback Software, LLC, Conifer, CO