tell me more icon Binding by Using JSF EL Expressions

JSF 1.2 supports the Java EE 5 unified expression language (EL), which unifies the JSF and JSP expression languages.

You use EL to create the bindings from component tags on JSF pages to properties (or other values) or methods on classes within the application. Method expressions provide a way to execute methods. Value expressions provide values for attributes on a component.

Value Expression Syntax

The syntax for value expressions follows that same syntax used by JSP 2.1 expression language, with the following exception: The delimiters must be #{ and }. JSF EL expressions now support EL functions.

Examples of value expressions follow:

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

Method Expression Syntax

Method expressions must use one of the following patterns:

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

The expression can be any JSF EL expression as described above, in Value Expression Syntax. The value must be an identifier that matches a method name on the object in the expression.

Operators

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, <, 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 ,,,,,,,,,,,,,,,