Post parameters to a JSP from an applet
949428Jul 14 2012 — edited Jul 19 2012Hello,
Is there a way to send a post request to a JSP page from an applet ? Here is the scenario I am looking for :
In Test.jsp, I invoke an applet. The applet should then do a POST request to the JSP. Currently, I am able to send a JSP request by appending parameters to the query string as
getAppletContext().showDocument(new URL(getDocumentBase(),"Test.jsp?querystring")); in the applet. But this will be showing the parameters in the URL. I would like to have the parameters sent as "POST". I tried doing something like
String data = "All URL encoded parameter names and values";
URL postURL = new URL("Test.jsp");
conn = (HttpURLConnection)postURL.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
wr.close();
But how do I pass the control back to the JSP ? Any thoughts ?