I am implementing an applet ---servlet communication. There are two parameters that need to be sent by applet to the servlet. I am not sure can I implement the transferring process as follows? If not, how to handle the transferring processing involving multiple parameters? Thanks.
Applet side:
// send data to the servlet
URLConnection con = getServletConnection(hostName);
OutputStream outstream = con.getOutputStream();
System.out.println("Send the first parameter");
ObjectOutputStream oos1 = new ObjectOutputStream(outstream);
oos1.writeObject(parameter1);
oos1.flush();
oos1.close();
System.out.println("Send the second parameter");
ObjectOutputStream oos2 = new ObjectOutputStream(outstream);
oos2.writeObject(parameter2);
oos2.flush();
oos2.close();
Servlet side:
InputStream in1 = request.getInputStream();
ObjectInputStream inputFromApplet = new ObjectInputStream(in1);
String receievedData1 = (String)inputFromApplet.readObject();
InputStream in2 = request.getInputStream();
ObjectInputStream inputFromApplet = new ObjectInputStream(in2);
String receievedData2 = (String)inputFromApplet.readObject();