[jboss-user] [JBoss Seam] - h:selectOneMenu and Ajax4jsf problem

felixk2 do-not-reply at jboss.com
Thu Dec 27 11:34:40 EST 2007


Hi,

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 />
  | </h:selectOneMenu>

My Bean:

@Stateful
  | @Name("customerList")
  | public class CustomerListAction implements CustomerList
  | {
  | 	private Reseller selectedReseller;
  | 	private List<Customer> customerListByReseller;
  | 	
  | 	@PersistenceContext
  | 	private EntityManager em;
  | 	
  | 	@Logger
  | 	private Log log;
  | 	
  | 	@In
  | 	private FacesMessages facesMessages;
  | 
  | 	@Create
  | 	public void getCustomerByResellerId()
  | 	{
  | 		try
  | 			{
  | 				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,
Felix

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115741#4115741

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115741



More information about the jboss-user mailing list