Expressions and Operators
The combination of literal values, variables and the following operators form an EL expression:
Operator |
Precedence |
Operation performed |
---|---|---|
. |
1 |
Accesses a bean property or |
[] |
1 |
Accesses an array or |
( ) |
2 |
Groups a subexpression to change the evaluation order |
+ |
5 |
Addition |
- |
5 |
Subtraction |
- |
3 |
Negation of a value |
* |
4 |
Multiplication |
|
4 |
Division |
|
4 |
Modulo (remainder) |
|
7 |
Tests for equality |
|
7 |
Tests for inequality |
|
6 |
Tests for less than |
|
6 |
Tests for greater than |
|
6 |
Tests for less than or equal |
|
6 |
Tests for greater than or equal |
|
8 |
Tests for logical AND |
|
9 |
Tests for logical OR |
|
3 |
Unary Boolean complement |
|
3 |
Tests for empty variable values ( |
Expressions are evaluated in the order defined by the operator precedence and left to right for operators of the same precedence.
Operand Coercing Rules
Before the operator is applied, the EL coerces the types of the operand values. An exception is thrown if no rule matches, the coercing fails or applying the operator leads to an exception.
Property and array accessor operators
An expression
of
the form ${exprA.identifierB}
is evaluated the
same way as ${exprA['identifierB'}
.
To evaluate an expression of the form
${exprA[exprB]}
, the following rules are used:
If
exprA
isnull
, return ...
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.