File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes setAction Problem HtmlCommandButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "setAction Problem HtmlCommandButton" Watch "setAction Problem HtmlCommandButton" New topic
Author

setAction Problem HtmlCommandButton

Andy Egli
Greenhorn

Joined: Nov 21, 2006
Posts: 3
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
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
change backing bean scope from request to session.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Call the createPanel() method in getPanel().


[ December 01, 2006: Message edited by: Bauke Scholtz ]
 
Consider Paul's rocket mass heater.
 
subject: setAction Problem HtmlCommandButton
 
Similar Threads
Binding, dynamic UIComponent treegeneration and display problem
How to get Values out of dynamic created panel
dynamic panel grid binding
How to get Values out of dynamic created panel
Dynamic UI generation problem while opening popup