Andy Egli

Greenhorn
+ Follow
since Nov 21, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andy Egli

Hi all

I get really bored. I tried to add an Action to a dynamic built HtmlPanelGrid. But the action method never gets called. Please help me!

mySite.xhtml:

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

myBean:

private HtmlPanelGrid panelGrid;
private HtmlCommandButton button;

public void createPanel(){
panelGrid = new HtmlPanelGrid();
HtmlInputText input = new HtmlInputText();
input.setId("in")
panelGrid.getChildren().add(input);
button = new HtmlCommandButton();
button.setValue("Submit it!");
MethodBinding mb = FacesContext.getCurrentInstance().getApplication() .createMethodBinding("#{myBean.send}", new Class[0]);
button.setAction(mb);
panelGrid.getChildren().add(button);
}

public void send(){
**Method never called**
}

public void setPanel(HtmlPanelGrid _panelGrid){
panelGrid=_panelGrid;
}

public HtmlPanelGrid getPanel(){
return panelGrid;
}

Regards Andy
17 years ago
JSF
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
17 years ago
JSF
Hi all




public class VehicleCharacteristicBean {


private HtmlPanelGrid panelGrid;

public void init(){
panelGrid=new HtmlPanelGrid();
panelGrid.setColumns(2);
createSelectPanel();
}

public VehicleCharacteristicBean(){
init();
}

public HtmlPanelGrid getPanel(){

return panelGrid;
}

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

}

public void change(ActionEvent event) {
UIComponent comp = event.getComponent();
}

public void createSelectPanel(){

ProductFacade facade= new ProductFacadeImpl();
List characteristics=facade.getProductInstanceData(1);

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 s= new ArrayList();
s.add(new SelectItem("","",""));
for(int i=0; i<value.size();i++){
s.add(new SelectItem((String)value.get(i),(String)value.get(i),""));
}

items.setValue(s);
menu.getChildren().add(items);
panelGrid.getChildren().add(label);
panelGrid.getChildren().add(menu);
}


}
}
17 years ago
JSF