问题
I have several applets in the same web page and i would like to share data between them.
What is the best solution to do this ?
EDIT :
Thank you for your responses, I will try to be more specific :
I have 3 applets on my web page :
- first one will download files from the web server
- second one will be used to modify the files localy
- third one will send back modified files to the server
Each applet will work on the files and I would like to store path, name, and other properties of files in an object which would be shared between the applets.
The solution consisting of using Javascript to communicate between applets seems not very secure for my case.
I will read more about AppletContext.
回答1:
Java<->JS is one well tried way to get information between applets, but see also the AppletContext.
This interface corresponds to an applet's environment: the document containing the applet and the other applets in the same document.
It provides methods like:
- getApplet(String)
- getApplets()
- getStream(String)/
getStreams()
/setStream(String,InputStream)
A stream is a very generic and powerful way to exchange information.
来源:https://stackoverflow.com/questions/11341692/how-to-share-data-between-applets-in-the-same-web-page