How to get print elements from an array in the JSF selectOneMenu, i am having an array in one bean class as
String[] leaveTypeArray;
Any suggestion for this ?
How to get print elements from an array in the JSF selectOneMenu, i am having an array in one bean class as
String[] leaveTypeArray;
Any suggestion for this ?
As luiggi-mendoza said that <f:selectItems>
will be a good one.
You can do it with List , just add the items in List or String[] in bean class
Bean(via List) :
List listValue=new ArrayList[];
static
{
listValue.add("First");
listValue.add("Second");
listValue.add("Third");
}
//Create getters and setters for listValue
Bean(via array) :
String[] listValue={"First", "Second", "Third"};
//Create getters and setters for listValue
JSF page
<p:selectOneMenu value="#{result value}">
<f:selectItems value="#{bean.listValue}"/>
</p:selectOneMenu>
Refer : Primefaces showcase