Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Post parameters to a JSP from an applet

949428Jul 14 2012 — edited Jul 19 2012
Hello,

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 ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2012
Added on Jul 14 2012
9 comments
5,542 views