Vinod, thank you for your post. I'm not sure, if I completely understood you, but I tried the following.
The visible button has now an actionListener. In this actionListener I do hidden.queueEvent(e); Where "hidden" is the hidden CommandButton (the one I want to click programmatically) and "e" is the ActionEvent of my visible CommandButton (the one that has the actionListener). When I click the visible CommandButton, the application runs in a loop, where the console repeats: "[FlowActionListener] No action event detected" over and over. Where did I get you wrong? Thanks again! :) -----Ursprüngliche Nachricht----- Von: users-return-56614-matthias.leis=sid.sachsen...@myfaces.apache.org [mailto:users-return-56614-matthias.leis=sid.sachsen...@myfaces.apache.org] Im Auftrag von Vinod Krishnan Gesendet: Donnerstag, 20. Mai 2010 10:53 An: MyFaces Discussion Betreff: Re: Click CommandButton from BackingBean yes you can do that using a binding for the second button and do it like queuing the event in the actionlistener of the first button getButton1().queueEvent(new ActionEvent(getButton2())); On Thu, May 20, 2010 at 1:16 PM, Leis, Matthias - SID-NLKM < matthias.l...@sid.sachsen.de> wrote: > Hi! > > Is it possible to click a <h:commandButton> from JavaCode? > > Code I have so far: > > public void clickButton() { > > FacesContext currentInstance = FacesContext.getCurrentInstance(); > > UIComponent component = > currentInstance.getViewRoot().findComponent("submit"); > > if (component instanceof HtmlCommandButton) { > > HtmlCommandButton submit = (HtmlCommandButton)component; > > } > > } > > This method is called by another button. The button I want to click is > hidden on purpose. Now I need something like submit.click(). Is there a > way? > > Thanks for any help :) >