Error when calling javascript method from applet

Posted by khue on Stack Overflow See other posts from Stack Overflow or by khue
Published on 2010-06-17T04:15:10Z Indexed on 2010/06/17 4:23 UTC
Read the original article Hit count: 510

Filed under:
|
|

Hi, I am trying to call javascript method from an Applet using netscapte.java.JSObject.

in the applet:

JSObject window = JSObject.getWindow(this.Class); 
Object[] args = ....  //arguments 
window.call("javascriptMethodName", args); 

But I get the exception at window.call:

JavaScript error while calling "callFromJava"
netscape.javascript.JSException: JavaScript error while calling "callFromJava"
    at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source)
    at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
    at sun.plugin2.main.client.MessagePassingJSObject.call(Unknown Source)
    at TextBoxApplet.jButton1_actionPerformed(TextBoxApplet.java:57)
    at TextBoxApplet.access$000(TextBoxApplet.java:16)
    at TextBoxApplet$1.actionPerformed(TextBoxApplet.java:36)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

The JSObject is NOT null. Have anyone encountered this ? Thanks a lot.

© Stack Overflow or respective owner

Related posts about java

Related posts about JavaScript