applet communication using post method

前端 未结 1 1274
长情又很酷
长情又很酷 2021-01-07 04:38

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 GE

相关标签:
1条回答
  • 2021-01-07 05:07

    First, you need to call (as you did):

    urlConnection.setDoOutput(true);
    

    Then obtain the OutputStream:

    OutputStreamWriter out = new OutputStreamWriter(urlConnection.getOutputStream());
    

    and write to it:

    out.write("paramName=" + paramValue);
    

    In the servlet, you can call request.getParameter("paramName")

    More details and instructions can be found here

    0 讨论(0)
提交回复
热议问题