aspose file tools*
The moose likes JSF and the fly likes How to get  Values out of dynamic created panel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to get  Values out of dynamic created panel" Watch "How to get  Values out of dynamic created panel" New topic
Author

How to get Values out of dynamic created panel

Andy Egli
Greenhorn

Joined: Nov 21, 2006
Posts: 3
Hi

I've created a dynamic panelGrid in my BackingBean and added some SelectOneMenues(The amount of the menues is not fix).

Now the page is displayed well, but I'havent found the right approach to identify and catch the selected values.

vehicleCharacteristic.xhtml:

<ice:form styleClass="defineCharacteristic" >
<ice:panelGrid binding="#{characterBean.panel}"/>
</ice:form>

The following Method builds my panel. Each Characterisitc Obj(current) feeds me with a labelname and values which are filled into the selectOneMenu

public HtmlPanelGrid createSelectPanel(HtmlPanelGrid panelGrid){
List characteristics=facade.getProductCharacteristics();
Iterator it=characteristics.iterator();
while(it.hasNext()){
Characteristic current=(Characteristic)it.next();
HtmlOutputLabel label=new HtmlOutputLabel();
label.setValue(current.getLabel());
HtmlSelectOneMenu menu= new HtmlSelectOneMenu();
menu.setId(current.getLabel());
UISelectItems items = new UISelectItems();
List value=current.getValues();
List selectedItems= new ArrayList();
for(int i=0; i<value.size();i++){
selectedItems.add(new SelectItem((String)value.get(i),(String)value.get(i),""));
}
items.setValue(selectedItems);
menu.getChildren().add(items);
panelGrid.getChildren().add(label);
panelGrid.getChildren().add(menu);
}
return panelGrid;


When I submit the form, the setPanel() Method is called and there is my Problem, how do I catch now the components and get the values out of it:

public void setPanel(HtmlPanelGrid _panelGrid){
this.panelGrid=_panelGrid;

//**How do I get here my selected values**//

}

Regards Andy
Sushma Sharma
Ranch Hand

Joined: Jun 02, 2005
Posts: 139
to get the selected values, I think you would need to iterate through the RequestParameterMap. and since you are generating the ids of the selectOneMenu, you can use the ids here.
Something like this:


I hope this is what you asked for..

Sushma
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get Values out of dynamic created panel
 
Similar Threads
setAction Problem HtmlCommandButton
Dynamic Table using PanelGrid/PanelGroup
Binding, dynamic UIComponent treegeneration and display problem
Dynamic HtmlSelectOneMenu : How to set the selected value in dropdown?
How to get Values out of dynamic created panel