I'm working with h:selectOneMenu and want to set label
and value
for it then the UI option list will display label
and in my Bean can get the selected value
. I have this code working fine:
<h:selectOneMenu value="#{myBean.selected}">
<f:selectItems value="#{myBean.myList}"/>
</h:selectOneMenu>
But problem appear when I try to add var to set label
and value
by adding the code below:
<h:selectOneMenu value="#{myBean.selected}">
<f:selectItems value="#{myBean.myList}" var="field"
itemLabel="#{field.label}" itemValue="#{field.value}"/>
</h:selectOneMenu>
The error show Attribute var invalid for tag selectItems according to TLD
.
My question are:
Can I resolve this?
If "YES" then "HOW"?
If "NO" then any other way for me to done this?
Thanks