Problem in getting Applet POST Method in ASP
I am having an applet with some textfields. I want to pass these form variables using POST method to ASP script which is a preview page. ( with Request.Form("formvariablename") )
I tried following test script but the button seems as if not having any action. What is wrong ? Please help. It will be great help if anybody send the tested sample code (manisha@aurica.com).
...
some code holding the applet panel with form text field and button
....
public void actionPerformed(ActionEvent event) {
try {
String uri = "http://manisha";
URL dataURL = new URL(uri);
URLConnection connection = dataURL.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
ByteArrayOutputStream byteStream =
new ByteArrayOutputStream(512);
PrintWriter out = new PrintWriter(byteStream, true);
String postData =
"firstName="+formvarname // var formvarname hold the value entered;
out.print(postData);
out.flush();
String lengthString =
String.valueOf(byteStream.size());
connection.setRequestProperty
("Content-Length", lengthString);
connection.setRequestProperty
("Content-Type", "application/x-www-form-urlencoded");
byteStream.writeTo(connection.getOutputStream());
}
....

