Java in JavaScript

G

gargoyle47

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
 
A

Arved Sandstrom

gargoyle47 said:
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
 
G

gargoyle47

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top