Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between #{...} and ${...} in EL Syntax [duplicate]

Tags:

jsf

jakarta-ee

el

My question is straightforward as you can see.

What is the difference between #{...} and ${...} in EL Syntax?

like image 802
Kowser Avatar asked Aug 26 '11 19:08

Kowser


1 Answers

Simply put, the ${} can do only a get, while the #{} can do a get and a set of the value.

In JSF on legacy JSP, the #{} syntax is mandatory to trigger auto-creation of managed beans and to set request parameters as model values. If you used ${bean.value} in a JSF page, then the managed bean with name bean won't be auto-created if it isn't already in the scope. Also, the managed bean property value won't be set if the form was submitted with that value in an input component.

In JSF on Facelets, the ${} is reinterpreted as #{} and thus they will behave exactly the same.

See also:

  • Difference between JSP EL, JSF EL and Unified EL
like image 144
BalusC Avatar answered Oct 10 '22 23:10

BalusC