im doing somme tests at home and everything is ok...
session/request or redirec/ no redirect doesnt change anything-selected value is always visible after submit


...3 people working on 1 page is not a good idea:D

Sławek

Do you have <redirect> set in the navigation rules? if yes - comment it :)
Michał Małecki


getSelected returns something that was set by setSelected.
framewrk takes care abut that what should be set and get so i dont have anything to this


or maybe i just dont understand something:/

Bruno - tomorrow i gonna check that scope(code left in job)...


The getSelected method should return the "value" of the SelectItem not the "label". That's what is wrong in your code.

i have:)

    }
      //other getters and setters
}

i just didnt want to paste all obvious code...


You don't have a setter in your bean. I don't know how you are getting
the correct value printed. Try with a setter for the member "selected"
in your bean.


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