#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    3
    Rep Power
    0

    Server Side form submission


    I need to submit a form from the server not the client's browser, any suggestions. Thank You
  2. #2
  3. No Profile Picture
    Java Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    5
    Rep Power
    0
    Yep,

    For example, assuming you mean an HTML POST to a servlet, then it'd be something like the following

    HttpURLConnection con = (HttpURLConnection)new URL("localhost/servlet/TestServlet");
    con.setRequestMethod("POST");
    con.setRequestProperty("Content-type", "text/html");
    con.setDoOutput(true);
    con.setDoInput(true);//If you want to process the reponse

    OutputStream out = con.getOutputStream();

    Then you send all your stuff to the stream, and when you close the output stream it should complete the POST

    hope that's of some help

IMN logo majestic logo threadwatch logo seochat tools logo