Communication between applets on a web page is very easy, because:
"...there is only one program per web page running. In fact there is only one program per browser running. Applets are just a bunch of ordinary objects. Applets from the same class share the same static variables! Objects can call each other's methods. They are all in the same address space."
This property of applets can be useful for improving the performance of applets that call the server for data. Since objects are shared between applets, each applet instance doesn't need to call the server individually. Instead, each instance can depend on a "server" object responsible for calling the server. The server object can cache requests from the "client" applets to minimize calls to the server.
The following classes illustrate sharing objects between two applets.
Singleton is a singleton class. It counts how many times Singleton.instance() has been called.
AppletA is an applet that calls Singleton.instance() when initializing.
AppletB is another applet that calls Singleton.instance() when initializing.
The first applet that loads will increment the count of Singleton.instance() calls. The second applet that loads will increment the count of Singleton.instance() counts again. The result is two applets that show different Singleton.instance() counts. Below is an example.
Download the code including the Java archive and a sample web page.