When the
onchange event below fired, it did not return the current selected item. For example, if I selected "2" in the dropdown list, this value is not returned in
bean1 method below:
<h:selectOneMenu id="selectPage" value="#{pageList.selectedPage}"
valueChangeListener="#{pageList.menuChanged}" onchange="pageChanged()">
<f:selectItems value="#{pageList.selectPages}" />
</h:selectOneMenu>
The
menuChanged method is:
public void menuChanged(ValueChangeEvent event) {
String value = (String) event.getNewValue();
FacesContext.getCurrentInstance().renderResponse();
}
For the
pageChange event of
bean1, I have this code to get the selected value of the selectOneMenu:
Object bean1 = FacesUtil.getRequestMap("pageList");
selectedPage = ((PageListing) bean1).getSelectedPage(); // always returns null
Object bean2 = FacesUtil.getRequestMap("langList");
selectedLang = ((LangListing) bean2).getSelectedLang(); // returns a value e.g. 'en', 'de', etc
where
FacesUtil.getRequestMap is:
public static Object getRequestMap(String bean)
{
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
return ec.getRequestMap().get(bean);
}
Why would
selectedPage returns null even though the
pageList.selectPages has values?
Edited by: icepax on 4/12/2009 06:17
Edited by: icepax on 4/12/2009 12:06