1

我开发了一个小程序,并在它完成某些任务时重新加载它。我使用javascript完成了这一点:

function startApplet() {
  // code to setup "object" tag
  var appletHtml = '<object name= ....'
  document.getElementById("applet_tag").innerHTML = appletHtml;
}

function restartApplet() {
  if (document.getElementById("applettag")) {
    document.getElementById("applet_tag").innerHTML = '';
  }
  startApplet();
}

这在某些机器上完美运行,但在其他机器上执行 javascript 代码但小程序不会重新加载(消失当前实例,启动一个新实例)

我已经尝试使用<param name="cache_option" value="no">或使用 jquery 代码来重置小程序 div,但没有成功。

任何人都知道这个问题或知道另一种在不刷新页面的情况下重新加载小程序的方法?


编辑:有关问题的更多信息:

查看 Java 控制台,我推断小程序有效地重新启动,但我认为我需要在新的 JVM 实例中重新启动小程序。下面,我附上了 Java 控制台的摘录:

basic: Applet loaded.
...
basic: Applet initialized
basic: Starting applet
...
basic: Applet started
basic: Told clients applet is started
basic: Starting applet teardown
basic: Finished applet teardown
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@d062ed
basic: PluginMain.unregisterApplet: 1 from mananger sun.plugin2.applet.Applet2Manager@ca5165

basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@185c219
basic: Plugin2ClassLoader.addURL parent called for http://...
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 359544 us, pluginInit dt 55298741 us, TotalTime: 55658285 us
Applet inicializado
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started
4

2 回答 2

1

在新 jvm 的 applet 中找到了解决方案,使用了separate_jvm applet 参数, applet deployment中的官方部署文档。谢谢你。

于 2013-06-10T18:21:11.880 回答
0

而不是直接调用 startApplet 将其设置为 15 秒超时。这将允许 jvm 退出。

function restartApplet() {
    if (document.getElementById("applettag")) {
        document.getElementById("applet_tag").innerHTML = '';
    }
    setTimeout("startApplet()", 15000);

}

新的 JVM 没试过,但你可以

var apltIdCnt = 1
function startApplet() {
    // code to setup "object" tag
    var appletHtml = '<div id=aplInner'  + apltIdCnt + ' <object name= ....'
    document.getElementById("applet_tag").innerHTML = appletHtml;
    apltIdCnt += 1 ;//or apltIdCnt++
}

如果其他标签具有不同的 jvm,这可能会有所帮助

于 2013-06-08T16:39:59.053 回答