myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bansi <>
Subject Is it possible to refresh the dropdown h:selectOneMenu
Date Wed, 14 Feb 2007 17:58:51 GMT

Here is my requirement

The user creates new record by selecting "New" value from the dropdown. Then
user enters values on form fields and clicks the Submit button. The result
is new Record gets created in the database and also gets populated in the
dropdown. But the dropdown still shows the "New" value whereas I want the
drop down to dynamically change from "New" to newly created value in the
drop down

The dropdown is populated from the database as shown below 

<h:outputText value="Manufacturer" />   
               <h:selectOneMenu id="manufList"
value="#{manufacturerBean.selectedManufacturer}" >             
<f:selectItem itemLabel="New" itemValue="New" />     
value="#{manufacturerBean.manufacturerList}" />                  
<a4j:support action="#{manufacturerBean.loadManufacturerDetails}"
event="onchange"   reRender="t3,t4,t5,t6,t7,t8,t9,t10" />                      

Here is the backing bean

public List getManufacturerList(){" *** In
getManufacturerList Backing Bean*** ");   List<Manufacturer> models = new
 List<SelectItem> manufacturers = new ArrayList<SelectItem>();  
 models =  manufManager.getManufacturerList();" *** manufManager List Size=*** "+models.size());     
 for (Iterator it = models.iterator(); it.hasNext();) {   
 Object[] row = (Object[]);   
 manufacturers.add(new   SelectItem(row[0]+"",row[1]+""));   }       
 return manufacturers;    

Any pointers/suggestions will be highly appreciated
View this message in context:
Sent from the MyFaces - Users mailing list archive at

View raw message