java httpclient post
- by Eric V
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