Hi Prasad,
Try changing your data to output the name of the value you are POSTing
first.
Your server won't know what the parameter is called otherwise...
eg:
Connect...
POST /servlet/myTest HTTP/1.0\r\n
Content-type: text/html\r\n
Content-length: 17\r\n
\r\n
>> server says: HTTP/1.1 100 Continue
>> server says: Server: Microsoft-IIS/4.0
>> server says: Date: Sun, 04 Apr 1999 11:22:04 GMT
myparameter=hello
Regards,
Neale Rudd
metawerx
http://www.metawerx.com.au
-----Original Message-----
From: Prasad Peddada <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Sunday, 4 April 1999 18:41
Subject: POST/Parameters
>Hi,
> I am trying to write an application program in java that makes a post
>request to a servlet. The servlet seems to service the request fine except
>it fails to read the parameter I am passing. The following is the piece of
>the application code. Could some one tell me how I should format headers to
>pass parameters to the servlet.
>
>Appreciating your help,
>Prasad
>
>String sdata = "Hello";
>//Http Header
>dataout.writeBytes("POST /servlet/myTest HTTP/1.0\r\n");
>dataout.writeBytes("Content-type: " + ctype + "\r\n");
>dataout.writeBytes("Content-length: " + (sdata.length()) + "\r\n");
>dataout.writeBytes("\r\n"); // end of header
>// POST data
>dataout.writeBytes(sdata);
>
>The output from the servlet is as follows
>
>HTTP/1.1 200 OK
>Server: JavaWebServer/1.1.3
>Content-Type: text/html
>Connection: close
>Date: Sun, 04 Apr 1999 07:21:34 GMT
>
><HTML>
><TITLE>Testing parameters </TITLE>
>java.lang.NullPointerException:
> at myTest.doPost(myTest.java:17)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:521)
> at javax.servlet.http.HttpServlet.service(Compiled Code)
> at com.sun.server.ServletState.callService(Compiled Code)
> at com.sun.server.ServletManager.callServletService(Compiled Code)
> at com.sun.server.http.InvokerServlet.service(InvokerServlet.java:101)
> at javax.servlet.http.HttpServlet.service(Compiled Code)
> at com.sun.server.ServletState.callService(Compiled Code)
> at com.sun.server.ServletManager.callServletService(Compiled Code)
> at com.sun.server.webserver.HttpServiceHandler.handleRequest(Compiled
Code)
> at com.sun.server.webserver.HttpServiceHandler.handleRequest(Compiled
Code)
> at com.sun.server.HandlerThread.run(Compiled Code)
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html