tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kenneth.baltz" <kenneth.ba...@inforonics.com>
Subject RE: POSTing from a servlet (and redirecting the client)
Date Wed, 19 Apr 2000 13:09:32 GMT
If you have a way to POST to the CGI from within your servlet, just hook up
the input stream(,writer, ..whatever) that you get from that request to the
servletoutput stream you send back to your client.  Not as elegant, but I
think that would work.  
 
K.C.

-----Original Message-----
From: Jeff Neuenschwander [mailto:jeff@collegeguy.com]
Sent: Wednesday, April 19, 2000 2:13 AM
To: tomcat-user@jakarta.apache.org
Subject: POSTing from a servlet (and redirecting the client)


I have been looking for some time for a way to initiate a POST request from
within a servlet.  I have figured out a way to do it, but it just opens up a
connection inside the servlet, but doesn't redirect the user's browser.
Basically I have a form where a user enters some data, the form is submitted
to a servlet that gets a value from a database based on a value that came
from the form.  I then need to servlet to POST the fields from the database
to a CGI page on another server (if it was a servlet on my server, I'd just
use a RequestDispatcher).  I know that sendRedirect() will redirect my page,
but I don't know how to tag some new POST data onto the top of it.  Right
now the best thing I have some up with is having the servlet generate an
html form with the values as hidden fields, and having the user press a
submit button, but there is no reason to really have them press the submit
button since the user doesn't enter any values.  They are all generated by
the servlet.
 
I know this is probably a simple question, but I have spent hours trying to
figure it out, with no avail.
 
Thanks for the help.
 
Jeff


Mime
View raw message