im trying to do it like this: //=======view========= <f:view> <h:form> <h:selectOneMenu value="#{test.selected}"> <f:selectItems value="#{test.options}"/> </h:selectOneMenu>
<h:commandButton action="#{test.act}"/> </h:form> </f:view> //===========bean======= public class Test { public Test(){ } public String act(){ System.out.println(">>>>>>act"+selected); return "go_back"; } private String selected; private SelectItem[] options;
public SelectItem[] getOptions() { options;new SelectItem[3]; options[0]=new SelectItem("1","1111"); options[1]=new SelectItem("2","2222"); options[2]=new SelectItem("3","3333"); return options; } public String getSelected(){ System.out.println(">>>>>>geter"+selected); return selected; } //other geters and seters }
after submit i can see correct string on the console (writen by act and getSelected) BUT on the gage i can see combo with text 1111. what can i do wrong? where should i search for bug?
thanks
Slawek