In JSF EL, what are value and method expressions?

Answered

In JSF EL, what are value and method expressions?

Ninja Asked on 19th September 2018 in JSF.
Add Comment
1 Answer(s)
Best answer

The EL defines two kinds of expressions: value expressions and method expressions.

  • Value expressions can either yield a value or set a value of bean’s properties. Value expressions can be further categorized into rvalue and lvalue expressions. Rvalue expressions can read data but cannot write it. Lvalue expressions can both read and write data. The expression ${} are always rvalue and #{} can support both rvalue and lvalue expressions.
  • Method expressions reference methods that can be invoked and can return a value. A method expression is a deferred method expression that is used to invoke an arbitrary public method of a bean, which can return a result.

For example, there is a managed bean called Student which has properties like name, id, age and a method called studentCount. The expressions #{student.name}, #{student.id}, #{student.age} represents deferred value expressions and #{student.studentCount} represents deferred method expression.

Ninja Answered on 19th September 2018.
Add Comment