I'm programming in JSF2 and netbeans creates many pages with #{}
that contains an expression.
However sometimes on the web I found ${}
for the same thing!
Are there any differences? What are they?
Google ignores the characters #
and $
so it makes it difficult to search for.
#{} are for deferred expressions (deferred expressions are resolved depending on the lifecycle of the page) and can be used to read or write from or to a bean or to make a method call. ${} are expressions for immediate resolution, as soon as they are encountered they are resolved. They are read-only. You can read more here: http://docs.oracle.com/javaee/6/tutorial/doc/bnahr.html
JSF EL uses a hash (#) where the JSP EL uses dollar sign ($) in jsf1.2 both syntaxes were unified
A google search for "Java Server Faces dollar pound" gave the following result, from the JBoss Expression Language FAQ:
The Java documentation gives the following explanation:
Read more here: value expressions
That's a good question! I faced it once and like you, had a lot of trouble finding the answer... until I stumbled upon this piece of documentation: