Appendix C. JSTL Expression Language Reference

This appendix contains a reference to the Expression Language (EL) defined by the JSTL specification, which sets action attributes to dynamic values evaluated at runtime. EL expressions can be used only for actions that have been specifically developed to support EL values, such as all JSTL actions in the EL library (see Appendix B), and custom actions that specifically state EL support, but none of the standard JSP actions support EL values. It’s expected that the EL definition will be incorporated in the next JSP specification version, making its use valid even for standard actions and all custom actions.

Syntax

An EL expression starts with the ${ delimiter (a dollar sign plus a left curly brace) and ends with } (a right curly brace).

<c:out value="${anExpression}" />

Any number of EL expressions and static text parts can be combined to set an attribute to the result of each expression concatenated with the text parts:

<c:out value="The result of 1 + 2 + 3 is ${1 + 2 + 3}" />

If the type for the attribute is not String, the result is converted to the attribute’s Java type as described later.

An attribute that accepts an EL expression also accepts a static text value:

<c:out value="The result of 1 + 2 + 3 is 6" />

In this case, the value is converted to the attribute’s type the same way as when expressions and static text is combined.

The language is case-sensitive. All keywords are in lowercase, and identifiers must be written with ...

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.