Thanks, it works! :) Another problem arises... It doesn't work inside a t:panelTabbedPane. By the way, this problem was the reason for the hidden button. The visible button was should be inside the t:panelTabbedPane, which then clicks the hidden button outside the t:panelTabbedPane. Argh
Staatsbetrieb Sächsische Informatik Dienste - Niederlassung Kamenz Macherstr. 63 01917 Kamenz E-Mail: matthias.l...@sid.sachsen.de -----Ursprüngliche Nachricht----- Von: users-return-56618-matthias.leis=sid.sachsen...@myfaces.apache.org [mailto:users-return-56618-matthias.leis=sid.sachsen...@myfaces.apache.org] Im Auftrag von Vinod Krishnan Gesendet: Donnerstag, 20. Mai 2010 13:20 An: MyFaces Discussion Betreff: Re: Click CommandButton from BackingBean it should be like hiddenButton.queueEvent(new ActionEvent(hiddenButton)); On Thu, May 20, 2010 at 4:41 PM, Leis, Matthias - SID-NLKM < matthias.l...@sid.sachsen.de> wrote: > 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 :) > > >