views:

24

answers:

0

Hi All,

I've a problem when i select option in selectonemenu it should populate the information next selectonemenu but the thing when i use a4j support it is calling second selectonemenu thrice using this code plz any one suggest me

  <h:form><h:selectOneMenu value="#{testBean.item}" validator="#{testBean.checkItem}"><f:selectItems value="#{testBean.selectItems}" /><a4j:support event="onchange" reRender="next"/></h:selectOneMenu> <br><h:selectOneMenu value="#{testBean.next}" id="next"><f:selectItems value="#{testBean.nextItems}" /></h:selectOneMenu><h:commandButton value="submit" action="#{testBean.action}"><h:messages /> </h:form>   
  public void checkItem(FacesContext facesContext, UIComponent component,
            Object value) throws Exception {

        System.out.println("checkItem"+value.toString());
        setItem(value.toString());

    }

 public List<SelectItem> getNextItems() {

     System.out.println("getNextItems");         
     nextItems = new ArrayList<SelectItem>();   
     nextItems.add(new SelectItem("1"));
     nextItems.add(new SelectItem("2"));

    return nextItems;
}

 {
     fillSelectItems(); 
 }
 private void fillSelectItems()
 {
     selectItems = new ArrayList<SelectItem>(); 
     selectItems.add(new SelectItem("One"));
     selectItems.add(new SelectItem("Two"));

 }

Thanks in advance Ravi