I'm sure there's a trivial solution to this but for some reason I can't figure it out.
I have an HTML form on my site that is submited to another site (i.e., ACTION="a url on someone else's site"). I need to capture some of the form data before sending it off to the other site. I tried creating a jsp that grabs the parameters I need and then calls response.sendRedirect() but in doing that I seem to lose all of the form parameters. Any ideas on how to do this?
You could use a Servlet that your form submits to and in your servlet grab what you need, then forward the request from there.
Um, yeah. That's what it is supposed to do. When you do a redirect, you are creating a new request. You have to forward a request to keep it's context. [ July 23, 2004: Message edited by: Gregg Bolinger ]
Originally posted by Bear Bibeault: Low tech approach: in your servlet/JSP process your params as appropriate, then construct an HTML form element with all the parameters as hidden controls. In an onload handler, submit the form.
Hi tech approach: use HttpConnection to establish your own connection to the other server and perform a post operation.
[ July 23, 2004: Message edited by: Bear Bibeault ]
Low tech: Thought about that. High tech: Am I right in assuming you mean org.apache.commons.httpclient.HttpConnection? This sounds like the way to go.