Java in JavaScript

Discussion in 'Java' started by gargoyle47, Oct 25, 2008.

  1. gargoyle47

    gargoyle47 Guest

    I want to use an HTML form incorporating JavaScript and also a Java
    applet.
    My idea is to have text entered in a webform, captured by the JS and
    then a Java applet called with the form text as the input argument.
    The applet will then manipulate the text and return a string back to
    JS for additional processing before being submitted as web form mail.

    I know how to invoke the applet from JS with input text:
    document.myApplet.newText(tempText) // invokes method in Java class
    and in the Java class:
    public void newText(String s) {
    this.whatToSay = s;
    etc.
    }

    but what I don't know how to do is return a string from Java back to
    the JS, i.e. how to capture the returned string using JS.

    Can somebody please help?
    Thanks
     
    gargoyle47, Oct 25, 2008
    #1
    1. Advertising

  2. "gargoyle47" <> wrote in message
    news:...
    >I want to use an HTML form incorporating JavaScript and also a Java
    > applet.
    > My idea is to have text entered in a webform, captured by the JS and
    > then a Java applet called with the form text as the input argument.
    > The applet will then manipulate the text and return a string back to
    > JS for additional processing before being submitted as web form mail.
    >
    > I know how to invoke the applet from JS with input text:
    > document.myApplet.newText(tempText) // invokes method in Java class
    > and in the Java class:
    > public void newText(String s) {
    > this.whatToSay = s;
    > etc.
    > }
    >
    > but what I don't know how to do is return a string from Java back to
    > the JS, i.e. how to capture the returned string using JS.
    >
    > Can somebody please help?
    > Thanks


    What happened with

    var result = document.myApplet.newText(tempText);

    Don't forget to change the return type of newText to String.

    AHS
     
    Arved Sandstrom, Oct 25, 2008
    #2
    1. Advertising

  3. gargoyle47

    gargoyle47 Guest

    On Oct 25, 12:24 pm, "Arved Sandstrom" <>
    wrote:
    > "gargoyle47" <> wrote in message
    >
    > news:...
    >
    >
    >
    > >I want to use an HTML form incorporating JavaScript and also a Java
    > > applet.
    > > My idea is to have text entered in a webform, captured by the JS and
    > > then a Java applet called with the form text as the input argument.
    > > The applet will then manipulate the text and return a string back to
    > > JS for additional processing before being submitted as web form mail.

    >
    > > I know how to invoke the applet from JS with input text:
    > > document.myApplet.newText(tempText)  // invokes method in Java class
    > > and in the Java class:
    > > public void newText(String s) {
    > > this.whatToSay = s;
    > > etc.
    > > }

    >
    > > but what I don't know how to do is return a string from Java back to
    > > the JS, i.e. how to capture the returned string using JS.

    >
    > > Can somebody please help?
    > > Thanks

    >
    > What happened with
    >
    > var result = document.myApplet.newText(tempText);
    >
    > Don't forget to change the return type of newText to String.
    >
    > AHS


    Now I remember, thanks.
     
    gargoyle47, Oct 27, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Kintner
    Replies:
    0
    Views:
    851
    Michael Kintner
    Nov 30, 2003
  2. Ilias Lazaridis
    Replies:
    0
    Views:
    581
    Ilias Lazaridis
    Feb 1, 2005
  3. mcdeveloper
    Replies:
    1
    Views:
    4,206
    mcdeveloper
    Jun 13, 2006
  4. manish sahu
    Replies:
    3
    Views:
    1,009
  5. Isaac
    Replies:
    0
    Views:
    379
    Isaac
    Jan 20, 2011
Loading...

Share This Page