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

H

huyi0912

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>
 
A

Andrew Thompson

My html have 2 frames...

That is the 'first sign of trouble'. Frames were always quirky
and problematic. More so as time goes by.
..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?

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..
I found if the applet was not dynamically inserted to the dom
tree,..

..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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top