This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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

Win a copy of Head First Android this week in the Android forum!
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

How to get Values out of dynamic created panel

Andy Egli

Joined: Nov 21, 2006
Posts: 3

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.


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

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();
Characteristic current=(Characteristic);
HtmlOutputLabel label=new HtmlOutputLabel();
HtmlSelectOneMenu menu= new HtmlSelectOneMenu();
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),""));
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){

//**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..

It is sorta covered in the JavaRanch Style Guide.
subject: How to get Values out of dynamic created panel
jQuery in Action, 3rd edition