Applet to Servlet

Discussion in 'Java' started by Angelo Marchionni, Feb 15, 2010.

  1. I m trying to send data from applet to servlet in this way

    ObjectOutputStream outputToServer = new
    ObjectOutputStream(servletConnection.getOutputStream());
    outputToServer.writeObject(user);
    outputToServer.flush();
    outputToServer.close();

    I expect data goes to doPost method of the servlet.
    But when I execute the above portion of the code just the doPost
    method is not called.
    What do I do wrong ?

    Thanks
     
    Angelo Marchionni, Feb 15, 2010
    #1
    1. Advertising

  2. Angelo Marchionni

    markspace Guest

    You'll need to show us the code before "new ObjectOutputStream(...".
    There must be something in the way you are setting up the HTTP
    connection that is causing an issue.

    Have you tested this servlet yet? Can it receive any POST at all, even
    from a browser? It doesn't hurt to verify the other side too, just in
    case the problem isn't where you think it is.
     
    markspace, Feb 15, 2010
    #2
    1. Advertising

  3. Angelo Marchionni

    Arne Vajhøj Guest

    On 15-02-2010 07:37, Angelo Marchionni wrote:
    > I m trying to send data from applet to servlet in this way
    >
    > ObjectOutputStream outputToServer = new
    > ObjectOutputStream(servletConnection.getOutputStream());
    > outputToServer.writeObject(user);
    > outputToServer.flush();
    > outputToServer.close();
    >
    > I expect data goes to doPost method of the servlet.
    > But when I execute the above portion of the code just the doPost
    > method is not called.
    > What do I do wrong ?


    Do you call:

    servletConnection.setRequestMethod("POST");

    ?

    Arne
     
    Arne Vajhøj, Feb 15, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Fish
    Replies:
    4
    Views:
    2,433
    Andy Fish
    Dec 17, 2003
  2. Sean Clarke
    Replies:
    1
    Views:
    1,925
    Sudsy
    Jan 7, 2004
  3. circuit_breaker
    Replies:
    2
    Views:
    2,052
    Jack Jia
    Apr 4, 2004
  4. chamikara
    Replies:
    1
    Views:
    49,917
  5. Tedy
    Replies:
    1
    Views:
    459
    Andrew Thompson
    Aug 4, 2005
Loading...

Share This Page