applet communication using post method

Posted by mithun1538 on Stack Overflow See other posts from Stack Overflow or by mithun1538
Published on 2010-03-20T18:01:47Z Indexed on 2010/03/20 18:11 UTC
Read the original article Hit count: 286

Filed under:
|
|
|

I have an applet that is communicating with a servlet. I am communicating with the servlet using POST method. My problem is how do I send parameters to the servlet. Using GET method, this is fairly simple ( I just append the parameters to the URL after a ?). But using POST method how do I send the parameters, so that in the servlet side, I can use the statement :

message = req.getParameter("msg");

In the applet side, I establish POST method connection as follows :

URL url = new URL(getCodeBase(), "servlet"); URLConnection con = url.openConnection();

con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestProperty("Content-Type","application/octet-stream");

© Stack Overflow or respective owner

Related posts about applet

Related posts about servlets