• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get Values out of dynamic created panel

 
Andy Egli
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic