LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Need a Java Applet to utilize Java Script Functions (https://www.linuxquestions.org/questions/programming-9/need-a-java-applet-to-utilize-java-script-functions-718200/)

circuit_girl 04-10-2009 08:48 AM

Need a Java Applet to utilize Java Script Functions
 
I want my applet to use java script funcions and code. I have been researching this forever and can not find an answer. It use to be able to be done in netscape using import netscape.javascript.*; or something along this line.

What is the new class file? Is there another way to do it?

aspire1 04-10-2009 12:54 PM

Tried it out using the first code example here http://www.rgagnon.com/javadetails/java-0172.html and it worked in Firefox

paulsm4 04-10-2009 12:59 PM

Hi -

The short answer is "no-can-do": the HTML DOM Javascript lives in - vs. the sandbox the applet lives in - are two completely separate domains.

The longer answer is: most of the time you'll want to do this kind of thing, you probably want to use server-side JSP's (rather than client side applets). Honest!

But if you *must* integrate Java and Javascript on the client (where it's hard) vs. on the server (where stuff like Tomcat or JBoss makes it much, much more straightforward): here's a link:

http://swinglabs.org/docs/presentati...ng_secrets.jsp

'Hope that helps .. PSM

PS:
In any case, you'll need some external .jar - and you'll need the client to be able to install it on their PC and integrate it with their browser's JRE - in order for it to work. And if the client uses Firefox and IE ... they'll probably have to install and configure twice...

circuit_girl 04-11-2009 09:55 PM

i figured it out. Thanks though.


All times are GMT -5. The time now is 03:33 AM.