Dear All,
I have an applet that sends data name, score and ScoreFile to a servlet that
get these data to be saved in a file. My question is, how can I send these data
from the servlet to the applet (reversed) so that I can use only the data name
in processing? Please help. Thank you.
Yours Sincerely;
TEH
The applet is as follows:
URL servletUrl = null;
URLConnection con;
String servletName = "http://localhost:8080/examples/servlet/ServerSide";
try {
servletUrl = new
URL(servletName+"?name="+name+"&score="+score+"&ScoreFile="+ScoreFile);
con=servletUrl.openConnection();
con.setUseCaches(false);
BufferedReader buf = new BufferedReader(new
InputStreamReader(con.getInputStream())); }
catch(Exception e) {
System.out.println("Exception caught..."+e); }
The servlet is as follows:
String name = request.getParameter("name");
int score = Integer.parseInt(request.getParameter("score"));
String ScoreFile = request.getParameter("ScoreFile");
String fileName = "C:/temp/"+ScoreFile;
FileWriter resultsFile = new FileWriter(fileName,true);
PrintWriter toFile = new PrintWriter(resultsFile,true);
toFile.println(name+" "+score);
toFile.close();
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.
Visit the Yahoo! Auto Green Center.