O'Reilly logo

JavaServer Faces by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using JSF EL Expressions

In Chapter 4, I introduced the JSP and the JSP 2.0 Expression Language (EL). JSP EL expressions are evaluated when the JSP page is processed—in other words, when the response is rendered.

JSF also supports an EL. Syntactically, the JSP 2.0 EL and the JSF EL are identical, but JSF may evaluate the EL expressions both when it processes input the user submitted (e.g., to update the application bean properties) and when it renders the response. This is the main difference between the JSF EL and the JSP EL.

Tip

To distinguish between a JSP EL expression and a JSF EL expression, you must use different delimiters for each type: a JSP EL expression is always written as ${ expression }, while a JSF EL expression is written as #{ expression }, i.e., with a #{ as the start delimiter instead of ${.None of the JSF custom action element attributes accept a JSP EL expression, only a JSF EL expression.

To bind a component’s main value to a property of a bean or an element of another data structure, JSF uses a value binding expression. A value binding expression is the part of a JSF EL expression that evaluates to a bean property, a java.util.List or array element, or a java.util.Map entry. The entity a value binding points to can be both read and written. In programming lingo, this amounts to what’s often called an rvalue (the right-hand side of an assignment expression) for read access and an lvalue (the left-hand side of an assignment expression) for write access.

Some components, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required