Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
huyi0912@hotmail.com - 19 Nov 2007 00:42 GMT
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>
Andrew Thompson - 19 Nov 2007 03:38 GMT
...
>   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.

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.