Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

expression language structure : #{}

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is EL structure : #{} on this exam objective?
I don't see it from the Head First study guide.
Thanks.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is EL structure : #{} on this exam objective?

Yes, it is part of EL v2.2.

I don't see it from the Head First study guide.

True, that is because HFSJ is based on EE5.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to this: http://docs.oracle.com/javaee/6/tutorial/doc/bnahu.html
#{} is for JSF.

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right, I don't recall that anybody mentioned getting questions about deferred method expressions on the WCD exam (although formally EL v2.2 it is part of the EE6 specs for the WCD exam). A quick search on this forum did not get any hits.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 types of EL syntax.

The ${} form originated with JSPs. It indicates expression substitution (a value. In other words, "${5 + 3}" is replaced at render time with "8".

The #{} form is used with JSF (and possibly other things). It indicates a value reference. For example, the JSF tag:


is used so that when rendering the form containing "text1", the current value of the backing bean "myBean"s "firstName" property will be rendered as the value of the HTML text TYPE=INPUT control and also so that when the rendered form is submitted back to the server that whatever the form's current value is will be used to set the firstName property of myBean. An "${}" expression, being a value expression cannot do that.

You will encounter #{} expressions such as 'rendered="#{not myBean.showThisField}"' which are value expressions containing operators, therefore not referencing a bean property. That's fine, since "rendered=" is a read-only property and therefore the client isn't going to have to figure out how to send it back to the server. The same can be said for output-only controls such as this:


In many such cases, a "${}" expression would serve just as well, but as a rule in JSF we do them all with #{} expressions, if for no other reason than because it's easier than spending time on determining whether a ${} is sufficient.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your nice explanation

Cow time!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic