Hi, All,
I have followed the code in Marty Hall's Core Web Programming to send POST data
directly to a servlet from an applet. The code I used is:
URL url = new URL(protocol, host, port, uri);
URLConnection uc = url.openConnection();
uc.setUseCaches(false);
uc.setDoOutput(true);
ByteArrayOutputStream bs = new ByteArrayOutputStream(512);
PrintWriter pw = new PrintWriter(bs, true);
pw.print("ID=PennywiseTheClown&Role=BallAndPlateTwirler");
pw.flush();
String lengthString = String.valueOf(bs.size());
uc.setRequestProperty("Content-Length", lengthString);
uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
bs.writeTo(uc.getOutputStream());
This works great in Internet Explorer. The use of request.getParameter() in my
servlet gets the ID and Role passed with pw.print. However, when I run the same code
in Netscape, request.getParameter() in my servlet yields a null value. Can anyone
tell me why this is happening, and/or how to fix it? I am using IE 5.0 and Netscape
4.76, JRun 3.0 with IIS running on NT4.0. Thanks in advance for any advice or help.
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists