473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Sending/returning a string from a Java Applet to JavaScript

Is it possible to have a Java Applet that is running on a web page to send/return a string (or an int) so that some JavaScript that is running on the same webpage can retrieve the information? If so, HOW?

Thanks!

-Bary-
Jul 20 '05 #1
2 4879
Hi,

Bary W Pollack wrote:
Is it possible to have a Java Applet that is running on a web page to
send/return a string (or an int) so that some JavaScript that is running
on the same webpage can retrieve the information? If so, HOW?

Thanks!

-Bary-


If the browser supports LiveConnect (IE and Netscape do), then it is
possible. See
<URL: http://www.galasoft-LB.ch/myjavascript/consulting/LiveConnect102>
and
<URL: http://www.galasoft-LB.ch/myjavascript/consulting/LiveConnect130>

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #2
On Fri, 1 Aug 2003 01:10:12 -0700, "Bary W Pollack"
<bp******@sierranevada.edu> wrote:
Is it possible to have a Java Applet that is running on a web page to send/return a string (or an int) so that some JavaScript that is running on the same webpage can retrieve the information? If so, HOW?

Thanks!

-Bary-


This is very easy to do. The Java applet needs a public method which
returns a String and all Javascript has to do is call it. Here's The
Modern CA Author Javascript which does this in a setting with frames
where the applet may not even exist:
var mutatedRule = 'Press the "Test CA" button first'
var d = parent.frames["view"].document
var applet = d.applets[0]
if (applet) {
mutatedRule = applet.getRuleCurrentMutation()
}

Here's what the Java method looks like:
public synchronized String getRuleCurrentMutation() {
return RuleExport.toString(rule, rule.mutated != null ?
rule.mutated : rule.unmutated);
}
George Maydwell
--
Modern Cellular Automata: www.collidoscope.com/modernca
Collidoscope Hexagonal Screensaver: www.collidoscope.com
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jared | last post by:
Hello people, I've had major difficulties finding the right Java technology that can be used to make an e-mail applet program. I'm trying to build an applet that would be similar, but much...
1
by: mark | last post by:
Adding an applet to a web page through the <object> tag, allows you to target the JVM in 2 ways. (ref. http://java.sun.com/products/plugin/versions.html ) 1. "Dynamic Versioning", which ...
2
by: Julian Hayward | last post by:
I recently "inherited" a project which involves an applet on a web page, and some Javascript event handling functions. The handler definition looks like this: <SCRIPT LANGUAGE=javascript...
2
by: annie | last post by:
Hi all. Can Java classes/objects be used from within the javascript code on the HTML page? I.e., can I call a Java method from the javascript function? Thanks in advance Anna
4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
9
by: Mickey Segal | last post by:
The long-simmering Eolas patent dispute: http://www.microsoft.com/presspass/press/2003/oct03/10-06EOLASPR.mspx has led to an optional Microsoft Update: http://support.microsoft.com/kb/912945/en-us...
7
by: D. Patrick | last post by:
I need to duplicate the functionality of a java applet, and how it connects to a remote server. But, I don't have the protocol information or the java source code which was written years ago. ...
3
by: Sanjay | last post by:
Hi Everyone, I am converting an image file into a Java string (via an applet) and would like to pass the Java string back to the Javascript function that calls the applet's. I know the simple...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.