2 Replies Latest reply on Dec 27, 2007 12:30 PM by Felix Khazin

    h:selectOneMenu and Ajax4jsf problem

    Felix Khazin Newbie


      I'm trying to change a rich:dataTable based on which dropdown item is selected. Here is my drop down:

      <h:selectOneMenu value="#{customerList.selectedReseller}">
       <a4j:support event="onchange" reRender="resultTableDiv" />
       <s:selectItems value="#{resellerList.resultList}" var="reseller" label="#{reseller.reseller}" noSelectionLabel="Select..."/>
       <s:convertEntity />

      My Bean:

      public class CustomerListAction implements CustomerList
       private Reseller selectedReseller;
       private List<Customer> customerListByReseller;
       private EntityManager em;
       private Log log;
       private FacesMessages facesMessages;
       public void getCustomerByResellerId()
       customerListByReseller = em.createQuery("select customer from Customer customer where reseller=:reseller")
       .setParameter("reseller", selectedReseller).getResultList();
       catch(Exception e)
       log.error("An error occured: ", e);
       @Destroy @Remove
       public void destroy()
       public void setSelectedReseller(Reseller selectedReseller)
       this.selectedReseller = selectedReseller;
       public Reseller getSelectedReseller()
       return selectedReseller;
       public void setCustomerListByReseller(List<Customer> customerListByReseller)
       this.customerListByReseller = customerListByReseller;
       public List<Customer> getCustomerListByReseller()
       return customerListByReseller;

      The rerender works fine. I can see the a4j rerendering because the datatable is hitting my "getCustomerByResellerId()" method (I see hibernate querying the database). Problem is with selectedReseller. It keeps coming back as Null. So the h:selectOneMenu doesn't place the selected Item into selectedReseller.

      Anyone see anything wrong with this and why this wouldn't work?

      Thank you very much,