| Reply | « Previous Thread | Next Thread » |
|
Hello,
I want a 7650 to send a String from a textfield as a parameter to a servlet. It works fine with the sun and nokia emulators but the 7650 does not seem to send anything to the server. I even hardcoded the parameter in the String, but still it only works with the emulators... Any known problems with the 7650 - Servlet - Communication??? Thanks a lot! |
|
I don't know for sure, but I had this same problem and I put "conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")" and it worked. Try the code above.
formData="action=list"; private DataInputStream process(String formData){ try{ //conn.setRequestProperty("Connection","close"); byte[] data=formData.getBytes(); //conn.setRequestProperty("content-Length", Integer.toString(data.length)); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); OutputStream os=conn.openOutputStream(); os.write(data); os.close(); int rc=conn.getResponseCode(); if (rc==HttpConnection.HTTP_OK){ DataInputStream dis=new DataInputStream(conn.openDataInputStream()); return dis; } }catch (Exception e){ System.out.println("Error processing game into the server:" + e.getMessage()); }finally{ try{ conn.close(); }catch (IOException e){ System.out.println("Error closing connection:" + e.getMessage()); } } return null; } |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|