Hi Tobias, The webservice responses by redirecting me to another webserver... It's simpler with the webform. But I consider to follow your suggestion, because it's indeed a lot more clean :)
Staatsbetrieb Sächsische Informatik Dienste - Niederlassung Kamenz Macherstr. 63 01917 Kamenz E-Mail: matthias.l...@sid.sachsen.de -----Ursprüngliche Nachricht----- Von: users-return-56622-matthias.leis=sid.sachsen...@myfaces.apache.org [mailto:users-return-56622-matthias.leis=sid.sachsen...@myfaces.apache.org] Im Auftrag von Eisenträger, Tobias Gesendet: Donnerstag, 20. Mai 2010 16:38 An: MyFaces Discussion Betreff: AW: Click CommandButton from BackingBean Hello Matthias, why don't you just submit the form normally to your webserver and let the webserver post to the web service? - This would probably be a lot more clean - architecture wise. Mit freundlichen Grüßen Tobias Eisenträger Softwareentwickler Dokumentenmanagement/Workflow/Internet, AKB 8125 ARAG IT GmbH ARAG Platz 1, 40472 Düsseldorf Tel.: +49 (0)211 964-1937 tobias.eisentrae...@arag.de www.ARAG.de Aufsichtsratsvorsitzender: Gerd Peskes Vorstand: Dr. Paul-Otto Faßbender (Vors.), Dr. Jan-Peter Horst, Dr. Johannes Kathan, Werner Nicoll, Hanno Petersen, Dr. Joerg Schwarze Sitz und Registergericht: Düsseldorf, HRB 1371 USt-ID-Nr.: DE 119 355 995 > -----Ursprüngliche Nachricht----- > Von: Leis, Matthias - SID-NLKM [mailto:matthias.l...@sid.sachsen.de] > Gesendet: Donnerstag, 20. Mai 2010 15:59 > An: MyFaces Discussion > Betreff: AW: Click CommandButton from BackingBean > > My Use Case: > I have a html-form to make a post request to some webservice by clicking > the submit-button. > > My Problem: > I am using a t:panelTabbedPane. I have to use a plain html-form, because > the value of the action-attribute is the URL of the webservice (and as far > as I know there is no way to define this value in a h:form). > For some reasons (I guess because of the t:panelTabbedPane) a plain html- > form isn't displayed on the page, when placed inside the > t:panelTabbedPane. Outside of the t:panelTabbedPane it works. So I put > this form outside of the t:panelTabbedPane and hide it per css. But the > button that triggers the post request has to be inside the > t:panelTabbedPane, so my idea was: html-form outside, visible button > inside, visible button "clicks" hidden button. But this doesn't work. But > if I place my visible button outside the t:panelTabbedPane (with the > actionListener code you provided) it works... But it's senseless, because > outside of the t:panelTabbedPane my plain html-form works anyway. > > > Staatsbetrieb Sächsische Informatik Dienste - > Niederlassung Kamenz > Macherstr. 63 > 01917 Kamenz > E-Mail: matthias.l...@sid.sachsen.de > > -----Ursprüngliche Nachricht----- > Von: users-return-56620-matthias.leis=sid.sachsen...@myfaces.apache.org > [mailto:users-return-56620- > matthias.leis=sid.sachsen...@myfaces.apache.org] Im Auftrag von Vinod > Krishnan > Gesendet: Donnerstag, 20. Mai 2010 15:15 > An: MyFaces Discussion > Betreff: Re: Click CommandButton from BackingBean > > I didnt quite follow you. could you please explain more.. > explain your use case as well > > On Thu, May 20, 2010 at 5:07 PM, Leis, Matthias - SID-NLKM < > matthias.l...@sid.sachsen.de> wrote: > > > 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 :) > > > > > > > > >