The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem with inter-applet communication

1 reply on 1 page. Most recent reply: Jan 26, 2006 12:41 AM by brajesh rathore

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Roki

Posts: 5
Nickname: rambo
Registered: Nov, 2002

Problem with inter-applet communication Posted: Oct 9, 2005 4:24 AM
Reply to this message Reply
Advertisement
I have inter-applet communication between two applets at my JSP page.
It work's OK, but when I put them into separate JAR archives they get loaded and started correctly at my JSP page, but they does't see each other (no inter-applet communication).
e.g., I got the following error:


java.lang.NoClassDefFoundError: com/myadd/pak1/Applet1
at com.myadd.pak2.Applet2.updateOtherApplets(Applet2.java:392)
at com.myadd.pak2.Applet2.access$500(Applet2.java:27)
...



Both applets contains updateOtherApplets method and it is very simillar.
For example, here is code excerpt from Applet2, so you can see how it is implemented:


private void updateOtherApplets() {
try {
Enumeration e = getAppletContext().getApplets();
while (e.hasMoreElements()) {
Applet aplet = (Applet)e.nextElement();
if (aplet instanceof Applet1) {
ql = calc(param1, ((Applet1)aplet).getT());
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}



And there is code excerpt from my JSP page:


<jsp:plugin type="applet" code="com.myadd.pak1.Applet1.class"
archive="applet_1.jar" codebase="/appcxt"
vspace="0" hspace="0" width="100" height="300" jreversion="1.4.1" >
<jsp:params>
...
</jsp:params>
</jsp:plugin>
...
<jsp:plugin type="applet" code="com.myadd.pak2.Applet2.class"
archive="applet_2.jar" codebase="/appcxt"
vspace="0" hspace="0" width="100" height="300" jreversion="1.4.1" >
<jsp:params>
...
</jsp:params>
</jsp:plugin>



Why there is no inter-applet communication between applets when I put them into JAR archives?


brajesh rathore

Posts: 1
Nickname: brajesh
Registered: Jan, 2006

Re: Problem with inter-applet communication Posted: Jan 26, 2006 12:41 AM
Reply to this message Reply
Hi,
Iam also getting the same problem for interapplet communication using the JSP plugin Tag.
The first Applet itself not loads and gives the error
"Applet notninitialized".

I have read lot of articles related to it and found that there is no solution for this type of problem.
My code is as below. I am using hidden applets in JSP plugin tags. If u found some solution, Please let me know.
Thanks
brajesh

--------------------------------------------------------- -
<%@ page language="java" %>

<HTML>

<HEAD>
<TITLE> WELCOME PAGE</TITLE>

</HEAD>

<script language="JavaScript">
<!-- Hide script from old browsers

function init(){

document.getElementbyId("myapplet1").style.visibility='hidden';
document.getElementbyId("myapplet1").style.display = 'none';
document.getElementbyId("myapplet2").style.visibility='hidden';
document.getElementbyId("myapplet2").style.display = 'none'

}

// -->
</script>

<body onLoad="init()">

<p align="center">WELCOME PAGE</p>
<BR>
<p align="center">Please wait while applet loads</p>
<p align="center">Please allow the applet to read the System Information</p>

<div id="myapplet1" style="visibility:hidden">
<%{ %>
<jsp:plugin
type="applet"
archive="/lib/combinedregistry_systemInfo.jar"
code="registryInfoApplet.class" codebase="/applet"
name="registryInfoApplet "
>
</jsp:plugin>
<%} %>
</div>

<div id="myapplet2" style="visibility:hidden">
<%{ %>
<jsp:plugin
type="applet"
archive="/lib/combinedregistry_systemInfo.jar"
code="systemInfoApplet.class" codebase="/applet"
name="systemInfoApplet"
>
</jsp:plugin>
<%} %>
</div>

</body>
</HTML>
--------------------------------------------------

Flat View: This topic has 1 reply on 1 page
Topic: Displaying  byte array as float values Previous Topic   Next Topic Topic: Help, .jar error

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use