In a JSF page I have a <f:selectItems/>
tag inside a <h:selectOneMenu/>
tag, and I know that I can determine the items from the managed bean:
<f:selectItems value="#{bean.items}" />
SelectItem[] items = {new SelectItem("1","value 1"),new SelectItem("2","value 2")};
But I was wondering if I could determine these values via XML, something like this:
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>chat.LoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>items</property-name>
<list-entries>
<value-class>javax.faces.model.SelectItem</value-class>
<value>value 1</value> <!-- The issue is here, there's a value and a label...what should I do? -->
</list-entries>
</managed-property>
</managed-bean>
You need to do something like this ...