| 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 |
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.