background image

Examples of EL Expressions

<< Operators | Using Functions >>
<< Operators | Using Functions >>

Examples of EL Expressions

and
or
not
eq
ne
lt
gt
le
ge
true
false
null
instanceof
empty
div
mod
Note that many of these words are not in the language now, but they may be in the future, so
you should avoid using them.
Examples of EL Expressions
Table 5­5
contains example EL expressions and the result of evaluating them.
TABLE 5­5
Example Expressions
EL Expression
Result
${1 > (4/2)}
false
${4.0 >= 3}
true
${100.0 == 100}
true
${(10*10) ne 100}
false
${'a' < 'b'}
true
${'hip' gt 'hit'}
false
${4 > 3}
true
${1.2E4 + 1.4}
12001.4
${3 div 4}
0.75
${10 mod 4}
2
${!empty param.Add}
False if the request parameter named Add is null or an empty
string.
${pageContext.request.contextPath}
The context path.
${sessionScope.cart.numberOfItems}
The value of the numberOfItems property of the
session-scoped attribute named cart.
${param['mycom.productId']}
The value of the request parameter named mycom.productId.
${header[
"host"]}
The host.
Unified Expression Language
The Java EE 5 Tutorial · September 2007
164