How to share data between applets in the same web page?

依然范特西╮ 提交于 2019-12-13 15:27:46

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!