hi every one
i need to pass the user define object as a value for h:selectOneMenu
it is possible in jsf.
i try it, but it gives NullPointerException. what is means i cant receive the object on my action bean from the h:selectOneMenu component.
this is my sample code.
Action class:
private User value; @Out(required=false) List<SelectItem> itemValue; @Factory("itemValue") public void populeate() { itemValue=new ArrayList<SelectItem>(); itemValue.add(new SelectItem(new User("a","b","c"),"a")); itemValue.add(new SelectItem(new User("1","2","3"),"b")); } public User getValue() { return value; } public void setValue(User value) { this.value = value; }
this is my jsf code
<h:selectOneMenu value="#{action.value}"> <f:selectItems value="#{itemValue}"/> </h:selectOneMenu>
by
Thiagu