This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSF and the fly likes Expression Language jspx Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Expression Language jspx" Watch "Expression Language jspx" New topic
Author

Expression Language jspx

Marta Gb
Greenhorn

Joined: Feb 23, 2011
Posts: 3
Hi,

I've read some topics about El and complex expressions but i have not get a solution yet.

I'm trying to get a value of a messages.properties file in a jspx and it works fine with any of this EL expressions:
"#{TWF_MESSAGES.messages['comun.pruebas']}" // a literal
"#{TWF_MESSAGES.messages[bean.name]}" // a bean attribute

The problem is that I've tried to concat them like:

"#{TWF_MESSAGES.messages['comun.pruebas' bean.name]}"

or

value='${TWF_MESSAGES.messages["menu.funcional.check. + bean.name]}'

without success (i've tried more combinations but I can't mix both conditions...)

I know that it can be done in the bean, but i want to get it in the jspx.

Any idea?
Thanks in advance!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

More like:


However, as a general rule, complex EL isn't recommended. It makes maintenance more difficult, tends to be hard to read - and to develop, and you don't get the benefits of compile-time checking that you do when using Java backing beans.

So a preferable way to do what you want is more like


and put the message logic in the "getNameMessage()" method of "myBean.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Expression Language jspx