Search code examples
jsf-2el

What are the differences between ${} and #{}?


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?


Solution

    • #{} are for deferred expressions (they are resolved depending on the life cycle 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