tags:

views:

223

answers:

1

I have a DataModel which has plan names and some other attributes.

I have different plans - gold , silver etc. But I dont want to display Gold or Silver as it is. Based on the locale, I want to display it from the messages.properties

Here is my code snippet:

           <h:dataTable value="#{newMemberController.membershipModel}"   
            var="plans" styleClass="gird_header_value">
            <h:column><h:outputText value="#{plans.name}" /></h:column>

So instead of plans.name value I want something like #{msgs.#{plans.name}} but this gives me a compilation error.

Does anyone know what is the correct syntax for this?

+2  A: 

You can use the brace notation to access Map values with a dynamic key: #{map[key]}.

Thus, the following example should do:

<h:outputText value="#{msgs[plans.name]}" />
BalusC