haven't found a way to get a servlet to to a POST to an external site.
i've only seen code for a java APPLET to do a post, but not a servlet...
:(
<IDEA>
hmm... maybe you could try a quick hack where...
1. servlet logs the click to external site.
2. servlet forwards the request to a JSP page that is identical to the
form that the user initially clicked, with the fields containing the
info they've put in, but this page also has a javascript that has ....
<script language="Javascript">
function submitForm(this) {
this.submit();
}
</script>
<body onLoad="submitForm(document.form1)">
<form name="form1" action="url of external site" method="post">
</form>
</body>
i might have some mistake in the javascrpt syntax, but you should get
the idea...
the dependency here is that the browser has to be able to recognise
javascript or have it turned on, but most of 'em do these days.
Vincent Stoessel wrote:
>
> Ok, here is what I was trying to do:
>
> I need to log outgoing connection from our site when a user clicks on
> a link that takes him to one of our partnet sites. When the click on a link
> that goes to another site they are first redirected to a servlet that logged
> the url they want to go to and then uses sendRedirect function to send along their
>merry
> way. It works great until we tried making our forms use it as well. sendredirect is
>not
> made for forwarding data not in the query string. the Requestdispatcher does do this
>but
> it seems to only work if the forward target in on the same server as forwarding page.
> is there a workaround?
>
> Ellecer Valencia wrote:
>
> > a sendRedirect() actually means the servlet sends a 302 response to the
> > browser, along with the specified URL. browser then does a GET from that
> > URL. as far as i know, there is no way to do a POST using
> > sendRedirect().
> >
> > can you give more detail on what you're actually trying to do? by "next
> > site" i assume it's an external site. does the next site require a
> > POST or can you just make do with just using get and having the fields
> > in the querystring?
> >
> >
> > Vincent Stoessel wrote:
> >
> >> Hi,
> >>
> >> I'm writing a simple redirector servlet
> >> for a part of my site. it seems that
> >> sendRedirect in javax.servlet.http.HttpServletResponse
> >> will change a POST method into a get as it redirects.
> >> Any work arounds for this? I need the post info to continue
> >> to the next site. Thanks.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html