Friday, July 27, 2012

JSF : Difference between $ and #

Difference between $ and # in ADF/JSF/JSP
JSP 2.1 and JSF 1.2 - both of them use a unified Expression language. One major and the most obvious difference is between $ and #. JSP 2.1 uses $ and JSF 1.2 uses # in an EL.
$ - immediate evaluation
# - deferred evaluation
$ - $ syntax executes expressions eagerly/immediately, which means that the result is returned immediately when the page renders.
# - # syntax defers the expression evaluation to a point defined by the implementing technology. In general, JSF uses deferred EL evaluation because of its multiple lifecycle phases in which events are handled. To ensure the model is prepared before the values are accessed by EL, it must defer EL evaluation until the appropriate point in the life cycle.