gpt4 book ai didi

Java Applet 问题与 Mozilla Firefox 和 Google Chrome 浏览器有关

转载 作者:行者123 更新时间:2023-11-29 06:08:54 26 4
gpt4 key购买 nike

当我在同一个浏览器上运行 Java Applet 的两个实例时,一个 Applet 的内容显示在另一个 Applet 上。

我发现这种行为的原因是由于使用了数据显示中涉及的静态变量。

问题出在 Mozilla FireFox 和 Google Chrome 浏览器上,而它在 Internet Explorer 上运行良好。

我需要在类之间共享一个变量来显示/操作数据。

我应该采取什么方法来防止使用静态变量或以这种方式共享变量以解决上述问题?

提前致谢。

CB

最佳答案

此行为是正确的,并且在此处找到的文档(标题为“类加载器缓存和小程序之间的交互”的部分)中有明确说明: http://download.oracle.com/javase/6/docs/technotes/guides/jweb/applet/applet_execution.html

(微软打破这一点的事实可能并不令人意外)

如该文档中所述,您可以通过以下方式关闭类加载器缓存以防止出现这种情况:

The new plug-in provides a way to opt out of the use of the class loader cache on an applet by applet basis.

<APPLET archive="my_applet.jar" code="MyApplet" width="300" height="300">
<PARAM name="classloader_cache" value="false">
</APPLET>

The default value of the classloader_cache parameter is true; class loader caching is enabled by default.

关于Java Applet 问题与 Mozilla Firefox 和 Google Chrome 浏览器有关,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7709762/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com