Expression Language


The expression language is used to easily access application data stored in JavaBeans components.

It has many implicit objects, operators and reserved words.

Syntax:

    ${expression}


The jsp compiler generates code for ${} for evaluation and then substitutes the value of the expression.

The implicit objects in the expression language are as follows:

Implicit objects Usage
pageContext Used to access the pageContext object.
pageScope Used to access value of a variable with page scope.
requestScope Used to access value of a variable with request scope.
sessionScope Used to access value of a variable with session scope.
applicationScope Used to access value of a variable with application scope.
param Used to request parameters as a single string.
paramValues Used to request parameters as a collection strings i.e. Arrays.
header Used to request header name as a single string.
headerValues Used to request header name as a collection of strings i.e. Arrays.
cookie Used to map the given cookie name with cookie value.

The arithmetic operators available in the expression language are as follows:

Operator Operation
+ Addition
- Subtraction
* Multiplication
/ (div) Division
% (mod) Modulo


The Logical and Relational operators available in expression language are as follows:

Operator Operation
== Equals
!= Not equals
< Less than
<= Less than or equals
> Greater than
>= Greater than or equals
&& Logical AND
|| Logical OR
! Boolean complement
empty Empty value

The reserved words in the expression language are as follows:

eq ne lt le
gt ge and or
not empty div mod
true false instanseof null