i have a selectOneMenu with selectitems.
if i use
<f:selectItem itemValue="3" itemLabel="#{hrBundle['phoneType3']}"/>
it works well, displaying the localized label. i have more options inside a List and when i use f:selectItems, it stops working.
this code:
<f:selectItems value="#{values}" var="item" itemLabel="#{hrBundle[item.label]}" itemValue="item.value"/>
shows the key(‘phoneType3’) as label, and even
<f:selectItems value="#{values}" var="item" itemLabel="#{hrBundle['phoneType3']}" itemValue="item.value"/>
(‘hardcoded’ as the single f:selectItem above) displays the key (‘phoneType3’) instead of the localized label.
any idea what i am doing wrong?
It depends on what the key in your bundle file is. If the key in your bundle ist the content of
item.value, do the following:I don’t know, if this is your original code. If yes, notice the following:
in your
valueattribute (as shownabove: replace
myBeanwith yourbeans name).
itemValueattribute needs anel expression as well:
itemValue="#{item.value}"