Click to See Complete Forum and Search --> : Java Applet & Javascript communicating?


mozoo
04-07-2003, 09:40 AM
After much time-wasting I still can't get any communication between a Java Applet and my Javascript web page, for some reason?

Has anyone a good working example of a Javascript calling a Java Applet`s method (sending parameters), for the Applet to work on and return, say, an array for the Javascript to use.

Source code for both the Jscript and the Applet would be appreciated :)

pyro
04-07-2003, 07:16 PM
This thread by khalidali63 should help you: http://forums.webdeveloper.com/showthread.php?s=&threadid=6858

viravan
04-08-2003, 08:59 PM
After much time-wasting I still can't get any communication between a Java Applet and my Javascript web page, for some reason?


If you're using swing component like JApplet, chances are it will not work because Netscape LiveConnect, which allows you to make two-way communications between Java and JavaScript has not been fully implemented by Sun.

:)

V.V.

mozoo
04-09-2003, 02:36 AM
Thanks for that, Viravan, what a shame they cant handle swing yet, it has been around for a few years now!

The link to the sample mentioned is http://68.145.35.86/skills/javascripts/applets/AppletJavaScriptInteraction.html .... but I can`t get the server to respond yet!
:(

Anyone else managed to load it or supply an Applet/Javascript sample please?

viravan
04-09-2003, 08:38 AM
After posting my question in khalidali63 thread, I played around with applets that I have written a few years back and found that with a few minor changes, I can get them to work with IE6 and NN7 (I no longer have NN4.79 on the machine). The notable changes are:

1) Remove all <OBJECT> and <EMBED> tags added by Java's htmlconverter. Using the <EMBED> tag will automatically prevent NN7 from calling a public method in a Java class file.

2) Add a note in the HTML file to tell the user which release of the JRE is required (this is necessary because the code needed to automatically download the correct version of the JRE is part of the <OBJECT> and <EMBED> tag which now must be removed.



khalidali63 example probably would have worked if the following parameter is added to the <applet tag>:

<APPLET ..... MAYSCRIPT="TRUE"></APPLET>

Why don't you try it.

:)

V.V.