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

后端 未结 5 1038
北恋
北恋 2020-12-22 21:09

I\'m programming in JSF2 and NetBeans creates many pages with #{} that contains an expression. However sometimes on the web I found ${} for the sam

5条回答
  •  甜味超标
    2020-12-22 21:29

    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:

    One key feature of the unified EL is its support for both immediate and deferred evaluation of expressions. Immediate evaluation means that the JSP engine evaluates the expression and returns the result immediately when the page is first rendered. Deferred evaluation means that the technology using the expression language can employ its own machinery to evaluate the expression sometime later during the page's life cycle, whenever it is appropriate to do so. Those expressions that are evaluated immediately use the ${} syntax, which was introduced with the JSP 2.0 expression language. Expressions whose evaluation is deferred use the #{} syntax, which was introduced with by JavaServer Faces technology.

提交回复
热议问题