Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Harry Hunter   on Mar 09 In Java Category.

  
Question Answered By: Orville Rodriguez   on Mar 09

I think the problem is that you set your Backing Bean Scope to Request. Try to
change it to Session and you'll see it saves the states of your DropDownLists
after submitting the page. Here is a very simple code  I use in my projects. As I
mentioned the BackingBean has Sessio scope:

<h:selectOneMenu binding="#{editExpertAddressInfoBackingBean.province}"
style="width: 160px"
valueChangeListener="#{editExpertAddressInfoBackingBean.provinceChanged}"
onchange="submit();">
<f:selectItem itemValue="" itemLabel="" />
<f:selectItems value="#{editExpertAddressInfoBackingBean.provinceItems}"/>
</h:selectOneMenu>


<h:selectOneMenu binding="#{editExpertAddressInfoBackingBean.city}"
style="width: 160px">
<f:selectItem itemValue="" itemLabel=""/>
<f:selectItems value="#{editExpertAddressInfoBackingBean.cityItems}"/>
</h:selectOneMenu>





public void provinceChanged(ValueChangeEvent e) throws AbortProcessingException
{
if (province.getValue() != null &&
!"".equals(String.valueOf(province.getValue()))){
Long id = Long.valueOf(String.valueOf(province.getValue()));
cityItems = loadCities(id);
} else{
cityItems.clear();
}
}

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on JSF component Or get search suggestion and latest updates.


Tagged: