Home

This Chapter
-Chapter 6: The Expression Language
-The Expression Language Syntax
-Accessing JavaBeans
-EL Implicit Objects
-Using Other EL Operators
-The EL in JSP 2.0
-Summary

Table of Contents
-Introduction
-Chapter 1: Model 2 and Struts
-Chapter 2: Input Validation with Action Forms
-Chapter 3: The HTML Tag Library
-Chapter 4: Input Validation and Data Conversion
-Chapter 5: The Validator Plugin
-Chapter 6: The Expression Language
-Chapter 7: JSTL
-Chapter 8: The Bean Tag Library
-Chapter 9: The Logic Tag Library
-Chapter 10: Struts-EL, Nested, selectLabel
-Chapter 11: Message Handling and Internationalization
-Chapter 12: The Tiles Framework
-Chapter 13: Securing Struts Applications
-Chapter 14: The Config Object
-Chapter 15: The Persistence Layer
-Chapter 16: Object Caching
-Chapter 17: File Upload and File Download
-Chapter 18: Paging and Sorting
-Chapter 19: Preventing Double Submits
-Chapter 20: Early HttpSession Invalidation
-Chapter 21: Decorating Request Objects
-Chapter 22: How Struts Works

Previous
Next

 

Chapter 6

The Expression Language

You have learned that a Struts action object may call a business method and store the result, which could be a transfer object or a collection containing transfer objects, in a request- or session-scoped variable. Scoped objects are accessible from JSPs through the use of custom tags, such as the out tag of the JavaServer Pages Standard Tag Library (JSTL). The syntax used by the out tag’s value attribute was first defined in the Expression Language (EL) of JSTL 1.0. Understanding the EL is key to accessing the model objects correctly in Struts and other Model 2 applications. The EL is so important that it is included in JSP 2.0. This means, you can use EL expressions to access scoped objects directly from JSP 2.0 pages. If you are using JSP 1.2, you can continue enjoying the power of the EL through the JSTL out tag.

This chapter explains the syntax of the EL and presents plenty of examples on how to use it.

Note

Struts also has its own custom tag libraries for manipulating scoped objects from JSPs, the Bean Tag Library and the Logic Tag Library. These libraries are discussed in Chapters 8 and 9. JSTL is discussed first to emphasize the fact that JSTL is more powerful than Struts tags and is the preferred library.

Note

Other chapters in this book use the JSTL:out tag instead of EL expressions so that those currently not using JSP 2.0 can still run the examples. Those lucky enough to have their projects in JSP 2.0 feel free to use the shorter EL expressions.

Previous
Next