What is the difference between #{} and ${} in JSF - Interview Question
In JSF, #{} and ${} are both used for evaluating expressions, but they have different purposes:
#{} Expression
The #{} expression is used for deferred evaluation. This means that the expression is evaluated when the view is being rendered. The values are not stored in the server-side bean, but are calculated each time the page is rendered. This can be useful for dynamic content or data that may change frequently.
${} Expression
The ${} expression is used for immediate evaluation. This means that the expression is evaluated when the component tree is built. The values are stored in the server-side bean, and are calculated only once during the lifecycle of the bean. This is useful for static content or data that does not change often.
Understanding the differences between #{} and ${} expressions in JSF can help you write more efficient and optimized code for your applications.
Please login or Register to submit your answer