I am posting some data in one servlet and trying to read it in the second
servlet.  I am using the getParameter method to read the data.  The
getParameter method always returns a null value for all the data.  Can some
one tell me where to look on the web.  I have looked at the archives and
that has not helped.  Thanks for the help.

**************** code from first servlet **********************
 StringBuffer sb = new StringBuffer(xyz.length());

 for ( int i=(xyz.length()-1); i>=0; i--)
 {
   sb.append(xyz.charAt(i));
 }
 URL url = new URL("http://sparc20:8080/servlet/CPP");
 int port = 8080;
 if (-1 != url.getPort())
    port = url.getPort();
 Socket conn = new Socket(url.getHost(), port);
 OutputStream output = conn.getOutputStream();
 BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(output));

 String rq = new String("POST"+url.getFile()+ "HTTP/1.0");
 String ct = new String("Content-Type: application/x-www-form-urlencoded");

 String cl = new String("Content-Length: " + (sb.length()+7));

 bw.write(rq, 0, rq.length());
 bw.newLine();

 bw.write(ct, 0, ct.length());
 bw.newLine();

 bw.write(cl, 0, cl.length());
 bw.newLine();
 bw.newLine();
 bw.write("inFile=", 0, 7);
 bw.write(sb.toString(), 0, sb.length());
 bw.newLine();
 bw.flush();
 conn.close();

 BufferedReader inStream = new BufferedReader(
         new InputStreamReader(url.openStream()));
 String inputLine;
 while ((inputLine = inStream.readLine()) != null)
  {
     out.println(inputLine);
  }
  inStream.close();
  }
     System.err.println("inStream closed ...");
 ********************************* end of code from first
servlet*************************

I try to read it as follows
************************* second servlet *******************8
 String aFile =request.getParameter("inFile");
 String rq =request.getParameter("rq");
 String ct=request.getParameter("ct");
 String cl=request.getParameter("cl");
***************** end of code from second servlet *********************

All the above values are nulls.   What else do I need to do?

___________________________________________________________________________
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

Reply via email to