开发者

Java Applet issue wrt Mozilla Firefox & Google Chrome browser

开发者 https://www.devze.com 2023-04-12 02:06 出处:网络
When I run two instances of the Java Applet on the same browser , the content of one Applet is displayed on the other Applet.

When I run two instances of the Java Applet on the same browser , the content of one Applet is displayed on the other Applet.

I found out that the reason for such a behaviour being due to use of static variables which are involved on the display of the data .

The issue is wrt Mozilla FireFox & Google Chrome browsers , whereas its working fine with Internet Explorer.

I need to share a no of variables between the classes to display/manipulate the data.

What should be my approach to prevent the use of static variables or rather share the variables in such a manner so that above i开发者_StackOverflow中文版ssue is resolved?

Thanks in advance.

CB


This behavior is correct and is explicitly stated in the documentation (The section titled "Classloader Cache and Interaction between Applets") found here: http://download.oracle.com/javase/6/docs/technotes/guides/jweb/applet/applet_execution.html

(The fact that microsoft breaks this is probably not a surprise)

As noted in that doc, you can turn off the Class loader caching to prevent this via:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号