background image

Where Value Expressions Can Be Used

<< rvalue Expressions | Seting Tag Attribute Values >>
<< rvalue Expressions | Seting Tag Attribute Values >>

Where Value Expressions Can Be Used

After declaring an enum constant called mySuit, you can write the following expression to test if
mySuit
is spade:
${mySuit ==
"spade"}
When the EL resolving mechanism resolves this expression it will invoke the valueOf method
of the Enum class with the Suit class and the spade type, as shown here:
mySuit.valueOf(Suit.class,
"spade"}
See
"JavaBeans Components" on page 167
for more information on using expressions to
reference JavaBeans components and their properties.
Where Value Expressions Can Be Used
Value expressions using the ${} delimiters can be used in the following places:
In static text
In any standard or custom tag attribute that can accept an expression
The value of an expression in static text is computed and inserted into the current output. Here
is an example of an expression embedded in static text:
<some:tag>
some text ${expr} some text
</some:tag>
If the static text appears in a tag body, note that an expression will not be evaluated if the body is
declared to be tagdependent (see
"Tags with Attributes" on page 229
).
Lvalue expressions can only be used in tag attributes that can accept lvalue expressions.
Unified Expression Language
Chapter 5 · JavaServer Pages Technology
153