tell me more icon Binding Using JSF EL Expressions

Introduced in Java EE 5.0 and JSP 2.1, the unified expression language (EL) is a union of the expression language offered by JSP 2.0 and the expression language created for JSF technology 1.0. The unified EL continues to let page authors use EL expressions to bind UI component values and objects to backing bean properties or reference backing bean methods from UI component tags.

Two kinds of expressions are defined in the unified EL: value expressions and method expressions. Value expressions allow both getting and setting data on external objects through bean properties, and can reference lists, maps, arrays, implicit objects, and resource bundles. Method expressions reference methods that handle component events, or validate or convert component data.

Value Expressions

The syntax for value expressions follows that same syntax used by JSP 2.0 expression language. Examples of value expressions follow:

  • #{foo}
  • #{}
  • #{}
  • #{foo[bar]}
  • #{foo["bar"]}
  • #{foo[3]}
  • #{foo[3].bar}
  • #{[3]}
  • #{ == "Hello World"}
  • #{( / 5 * 3}
  • Offer Valid from #{offer.validFromDate} to {offer.validToDate}

Method Expressions

Method expressions must use one of the following patterns:

  • #{expression.value}
  • #{expression[value]}

The expression can be any EL expression as described earlier for value expressions; the value must be an identifier that matches a method name on the object in the expression.


Expression language provides the following operators, in addition to the . and []operators:

  • Arithmetic: +, - (binary), *, / and div, % and mod, - (unary)
  • Logical: and, &&, or, ||, not, !
  • Relational: ==, eq, !=, ne, <</code>, lt, >, gt, <=, ge, >=, le. Comparisons can be made against other values, or against boolean, string, integer, or floating point literals.
  • Empty: The empty operator is a prefix operation that can be used to determine whether a value is null or empty.
  • Conditional: A ? B : C. Evaluate B or C, depending on the result of the evaluation of A.

Copyright © 1997, 2009, Oracle. All rights reserved.

false ,,,,,,,,,,,,,,,