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 :) >