How can I access the dynamically inserted applet from another applet?

Discussion in 'Java' started by huyi0912, Nov 19, 2007.

  1. huyi0912

    huyi0912 Guest

    Hi!
    My html have 2 frames.One is control frame which have a control
    applet loaded.Another frame's content will be insert a dynamically
    generated applet.But the dynamically generated applet can not get
    access to the control applet through it's static variable.How is that?
    I found if the applet was not dynamically inserted to the dom
    tree,then it can access my control applet.I print the classloader of
    each applet and found they are loaded by different classloader(though
    their root is the same).It should work for dynamically inserted applet
    also because all the pages and applet have the same codebase.Any help
    will be appreciated!
    The dynamically inserted applet code snippet:

    <script>
    function insertApplet(){
    var div = document.getElementById("appletDiv");
    div.innerHTML = "<OBJECT ID='"+appletID+"' classid='clsid:
    8AD9C840-044E-11D1-B3E9-00805F499D93' width='300' height='300'>"+
    "<PARAM name='code'
    value='com.jaspect.applet.AppletPanel.class'> "+
    "<PARAM NAME='codebase' VALUE='http://localhost:8080/html'>
    "+
    ...
    "</OBJECT>";
    }
    </script>
    <body onLoad="insertApplet{}">
    ....
    </body>
     
    huyi0912, Nov 19, 2007
    #1
    1. Advertisements

  2. That is the 'first sign of trouble'. Frames were always quirky
    and problematic. More so as time goes by.
    What browser? The very fact you would not mention the
    browser (make + version), OS (make + version), and JRE
    (make + version), indicates to me that you do not have much
    experience 'wrestling with' applets in browsers, because..
    ..besides that, there are no guarantees that applets in the
    same page, different frames of the same page, different 'tabs',
    or different browser instances, will share a VM (or not).

    It is all up to the browser/VM combo.

    (big trim...)

    You spend more words describing the whole complex
    situation, but I am going to ask something you did not
    think to mention.

    What is this all for? Or better still..
    What do these applets do for the end user?

    There may be an altogether better alternative to providing
    this functionality, but it is important to understand the point
    of it all.

    --
    Andrew Thompson
    http://www.athompson.info/andrew/

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
     
    Andrew Thompson, Nov 19, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.