Link to home
Start Free TrialLog in
Avatar of mmanfra
mmanfra

asked on

Passing data from applet back to html form ?

I'm writing an applet that has a customized list .  Once
the user picks an item from the list, is there anyway to send this data back to the .html form that called it??

I see you can pass parameters from the .html to the applet, but can information be passed back?  I'm trying not to
program the entire form in java.

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of rembo
rembo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Philippe
Philippe

This is how I send back information to a cgi-script on my server:

Note that the applet does not fill the form, but it calls the same cgi-script as the form does and passes the parameters directly to the cgi script.


qs is the query string which is appendend to the name of the cgi-sript.
cgiHome is the the location of the script (eg: www.home.com/cgi-bin/)


      try {
      String thisLine;
      String qs = "item="+item +"&price="+price;

      URL u = new URL(cgiHome + "results?" + qs);

      DataInputStream theHTML =
             new DataInputStream(u.openStream());
      while ((thisLine = theHTML.readLine()) != null) {
      parent.showStatus(thisLine);
      }
    }
    catch (Exception e) {
      System.err.println(e);
    }
 

Let me resubmit it as an answer if this is what you wanted.

 cheers,

    Philippe