java httpclient post
Posted
by Eric V
on Stack Overflow
See other posts from Stack Overflow
or by Eric V
Published on 2010-04-10T02:03:25Z
Indexed on
2010/04/10
2:13 UTC
Read the original article
Hit count: 600
Hi,
I have a question about how to allow my jsp page to issue a post command to the server, and still have the browser fallow the re direction of the posted page.
Here are the code snipets:
code that does the post (this is inside a jsp file):
HttpClient client = new DefaultHttpClient(); client.getParams().setParameter("SUBMITTED", "submitted"); client.getParams().setParameter("xxxxxxxx", purchaser.getemail()); client.getParams().setParameter("xxxxxxxx", purchaser.getsuject());
HttpPost method = new HttpPost(url+"process.jsp"); client.execute(method);
here is a snipet of process.jsp
if (person.getStatus() == person.ACTIVE) response.sendRedirect("Account.jsp); else if (person.getStatus() == person.ERROR) response.sendRedirect("Error.jsp);
I would like the browser to the fallow/goto the redirect from the process.jsp. Does anyone know a tutorial that would help me or Am I going about this the wrong way.
Thanks, eric
© Stack Overflow or respective owner