Closed
Bug 73271
Opened 25 years ago
Closed 25 years ago
Cannot access applet methods from JavaScript
Categories
(Core Graveyard :: Java: OJI, defect)
Tracking
(Not tracked)
People
(Reporter: desale, Assigned: edburns)
References
()
Details
BUILDS: 03-21-04.
STEPS TO REPRODUCE:
1] Please visit URL mentioned above.
2] Enter something in text-Box.
3] Click button "Upper" & then click button "Lower"
EXPECTED RESULTS:
On clicking "Upper", The text in text-box should change from lower case to upper
case.
On clicking "Lower", The text in text-box should change from upper case to lower
case.
ACTUAL RESULTS:
Nothing happens.
DESCRIPTION:
The methods upper and lower are in Applet, and are being called from Javascript.
Here is applet code:
########## APPLET CODE START ###########
import java.applet.Applet;
import java.lang.*;
import netscape.javascript.JSException;
import netscape.javascript.JSObject;
public class simple_applet extends Applet
{
JSObject win, doc, form, field;
public void init()
{
// BE CAREFULL : the form must have been define before the applet starts
// --> <APPLET> tag must be embeded after the form
win = JSObject.getWindow(this);
doc = (JSObject)win.getMember("document");
form = (JSObject)doc.getMember("the_form");
field = (JSObject)form.getMember("the_field");
}
public void upper()
{
String text = (String)field.getMember("value");
System.out.println("Text = " + text);
field.setMember("value", text.toUpperCase());
}
public void lower()
{
String text = (String)field.getMember("value");
System.out.println("Text = " + text);
field.setMember("value", text.toLowerCase());
}
}
############# APPLET CODE END ####################
Here is HTML source of the page.
############ HTML SOURCE START ###################
<html>
<head>
<title>A simple example of LiveConnect features</title>
</head>
<body>
<h1>A simple example of LiveConnect features</h1>
<FORM NAME="the_form">
Enter a text <INPUT TYPE=input NAME="the_field"><P>
<INPUT TYPE=button VALUE="Upper"
onClick=document.simple_applet.upper()>
<INPUT TYPE=button VALUE="Lower"
onClick=document.simple_applet.lower()>
</FORM>
<APPLET CODE=simple_applet.class NAME="simple_applet" MAYSCRIPT WIDTH=0
HEIGHT=0></APPLET>
</body>
</html>
################## HTML SOURCE END ###############
Comment 1•25 years ago
|
||
Confirming bug with debug Mozilla build 2001-0322 on WinNT.
The testcase works fine in NN4.7, but in Mozilla you get this error
in the JavaScript Console:
JavaScript error:
line 0: uncaught exception: java.security.PrivilegedActionException
<<java.lang.reflect.InvocationTargetException>>
Reassigning to OJI, and cc'ing some of the people looking at recent
bugs like this. I think this is a duplicate of one of them, but I'm
not sure which. Perhaps bug 59447? bug 61488? bug 59983? etc. etc.
Assignee: rogerl → edburns
Component: Live Connect → OJI
OS: Windows 95 → Windows NT
QA Contact: pschwartau → shrir
Summary: can not acess applet methods from Javascript. → Cannot access applet methods from JavaScript
Comment 2•25 years ago
|
||
I would encourage people evaluating this bug to also look at the /MUCH/ simpler
test case I provided at the URL for bug 61488. That test case involves only
communication from Javascript->Java and contains no references to JSObject.
| Reporter | ||
Comment 3•25 years ago
|
||
I was not able to find bug# 61488, before filing this one. Later on I did.
Its duplicate of bug# 61488. Marking duplicate.
*** This bug has been marked as a duplicate of 61488 ***
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•