i want to put combobox on the page and submit button. after submit and performing somme action view returns to the _same_ page. then i'd like to see in that combobx value that i just jave selected. for exampe combo have values: 1111, 2222, 33333 and i choose 2222 -> click button ->request -> response. after that i'd like to see the combo set to 2222 but NOT 1111. in other words i'd like that HTML option 2222 has property selected.

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

Reply via email to