CELEBRATE EARTH WEEK
Save 70% on video training and simulators now through April 27*—use code EARTH. Shop now.
The breakthrough solution for easier, faster, and more powerful Web development.
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:
Core JSTL shows you how to:
Click here for a sample chapter for this book: 0131001531.pdf
JSTL Overview. Getting Started. A Simple JSTL Web Application. JSTL Design Principles.
Expression Language Overview. Expressions. Identifiers. Operators. Type Coercion. Literal Values. Implicit Objects. Method Invocation. EL Expressions in Custom Actions. Common Mistakes.
General-Purpose Actions. Conditional Actions. Using Conditional and General-Purpose Actions Together. Conditional Custom Actions.
The <c:forEach> Action. The <c:forTokens> Action. Iteration Status. Custom Iteration 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.
Overview. The Config Class.
Overview. I18N and L10N. Localization Contexts. An Overview of the I18N Actions. Use of <fmt:message. Request Encoding. I18N Custom Actions.
Formatting and Parsing Numbers. Formatting and Parsing Dates and Times. Using Time Zones. Determining a Formatting Locale.
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.
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.
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.
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.
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:
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.