Hi,

we have had the same problems. We have solved them via creating our own
form component (a la like the s:form in the sandbox of tomahawk but with
some changes) and it works quite nice.

If you are interested, I can send you the implementation. 

The idea behind is to create a from with some extra attributes for
servername, port, method, applicationRoot and such like this.

The only one problem is you cannot use the commandButton or commandLink
in this form. But with <f:verbatim><input type="submit"/></f:verbatim>
it is easy.

Hope this helps,

- waffel

-----Original Message-----
From: Andrew Robinson [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 28. September 2006 17:29
To: MyFaces Discussion
Subject: Re: can we post to another web application from a button action
?

It would be a GET method. If you want to post to a new site and
display the result to the user, you would probably need to render a
form that is submitted to the new site and then force the form to post
on load.

The other alternative, is to post it yourself on the back end using
HttpUrlConnection and then simply stream the output to the browser.
Note that this can be tricky with relative links in the page as well
as cookies (so that will not be an easy solution).

On 9/27/06, legolas wood <[EMAIL PROTECTED]> wrote:
> Will that method (redirect and return null) post to that URL ?
> the web site that i should pass the parameters just works with POST
> method and no other mechanism.
> thanks
>
>
> Andrew Robinson wrote:
> > Do you want to send him/her to that page or do you want to just post
> > data and "ignore" the response from that website?
> >
> > If you want to send them, create a navigation rule with the full URL
> > (if it is static) with a "redirect" set. Then return that action
> > result.
> >
> > If you want to send them but the URL is dynamic:
> > 1) create a custom navigation handler that performs a redirect
> > -or-
> > 2) redirect and return null:
> >
> > public String myAction()
> > {
> >  // your business code
> >
> >  FacesContext facesContext = FacesContext.getCurrentInstance();
> >  facesContext.getExternalContext().redirect(someURL);
> >  facesContext.responseComplete();
> >  return null;
> > }
> >
> > On 9/26/06, Legolas Woodland <[EMAIL PROTECTED]> wrote:
> >> Thank you for reply.
> >> what about sending them from server side ?
> >> if i send user to that url from serverside i can make my database
change
> >> and then send him/her to other web site.
> >> can i have an action for outputlink and also send the user to other
web
> >> site?
> >> for example in action binding i made database change and when
he/she
> >> clicked on it i post the parameter to that website?
> >>
> >> thanks
> >>
> >> Andrew Robinson wrote:
> >> > Do you want to post from the client or the server? If from the
client,
> >> > just use the "normal" method. You can use h:outputLink with
embedded
> >> > f:param elements.
> >> >
> >> > On 9/26/06, Legolas Woodland <[EMAIL PROTECTED]> wrote:
> >> >>
> >> >>  Hi
> >> >>  Thank you for reading my post
> >> >>  I need to use post method to send some parameters to a web
site,
> >> >>  now , in my web application which is based on jsf , i do not
know
> >> >> how i can
> >> >> do this as parameters has their name and also i should compute
their
> >> >> values
> >> >> before i post them to other web site.
> >> >>
> >> >>  should we do this in button action method or there are some
other
> >> ways?
> >> >>  thanks
> >> >>
> >> >
> >>
> >>
> >
>
>

Reply via email to