myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vinod Krishnan <vin.si...@gmail.com>
Subject Re: Click CommandButton from BackingBean
Date Thu, 20 May 2010 08:53:13 GMT
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.Leis@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 :)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message