I am using a <h:selectOneMenu>
to send a state value to the backing bean. When I click on the <h:commandLink>
the value is being picked up in the bean correctly (in the log.debug
message). However, when the page reloads, the selected State is lost and the one at the top (NY) appears in the UI. Shouldn't the value of the one selected be retained? Any suggestions much appreciated.
I am using JSF 1.2.
JSP:
<h:selectOneMenu id="state" value="#{stateBean.stateName}">
<f:selectItem itemValue="NY" itemLabel="New York" />
<f:selectItem itemValue="CA" itemLabel="California" />
<f:selectItem itemValue="NE" itemLabel="Nebraska" />
<f:selectItem itemValue="AK" itemLabel="Alaska" />
</h:selectOneMenu>
<h:commandLink action="#{stateBean.sendStateAction}">
Managed Bean:
private String stateName;
log.debug("state name: " + stateName);
public String getStateName() {
return stateName;
}
public void setStateName(String name) {
this.stateName = name;
}