Denny,
If you can tell me an easier way of doing this, I would appreciate it. I
think that I am working too hard, but I do not know any better. The
objective here was to be able to send large amount of data as a POST method
to a the second applet. Please say a little more about the session objects
as well.
Thanks,
Syed
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Danny Rubis
Sent: Thursday, August 03, 2000 8:49 PM
To: [EMAIL PROTECTED]
Subject: Re: getParameter returns null
Hey!
I just can not understand why you are doing it this way. You may
have good reason, but your E does not say.
Why can't you use session objects for
> String aFile =request.getParameter("inFile");
>String rq =request.getParameter("rq");
>String ct=request.getParameter("ct");
>String cl=request.getParameter("cl");
I think you may be working way too hard.
Sans adieu,
Danny Rubis
Syed Mahmoods wrote:
> 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
___________________________________________________________________________
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