我有以下刷新计时器:
<s:url id="getDeployQueue" action="deploymentQueue" >
<s:param name="readonly" value="readonly" />
</s:url>
<sx:div id="deploymentQueue" href="%{#getDeployQueue}" errorText="Oh wait, I couldn't get the queue right now!"
formId="queueForm" executeScripts="false" preload="true" listenTopics="refreshqueue"
autoStart="true" updateFreq="8000" startTimerListenTopics="/startDeployQueue" stopTimerListenTopics="/stopDeployQueue" />
我遇到的问题是,在加载内容之前它等待8000毫秒,即使我有preload =“true”。在此之后它按照我的预期运行,每8000毫升重新加载一次内容。删除updateFreq =“8000”会导致div正确预加载,但我的计时器无法启动。
这是预期的行为吗?如果有的话有解决方法吗?
我曾经通过在sx:div标记中嵌入html来解决这个问题,但是Firefox 3.5现在因为包含表单的html以及尝试在其顶部写入的ajax而使用此方法引发安全性错误。
答案 0 :(得分:2)
似乎没有人有答案,我使用以下
解决了这个问题<sx:div id="combinedQueue" href="%{#getCombinedQueue}" errorText="Awww Snap I can't get the queue" formId="queueForm" executeScripts="false"
autoStart="false" updateFreq="15000" preload="false" showLoadingText="false" listenTopics="refreshqueue" startTimerListenTopics="/startDeployQueue" stopTimerListenTopics="/stopDeployQueue">
<noscript>
<tiles:insertAttribute name="queue" />
</noscript>
<!-- Preload the deployment queue, this is done to avoid security precautions new to firefox 3.5 -->
<sx:div id="combinedQueuePreload" href="%{#getCombinedQueue}" errorText="Awww Snap I can't get the queue"
executeScripts="false" preload="true" showLoadingText="false" afterNotifyTopics="/startDeployQueue" />
</sx:div>
在最新的firefox中似乎失败了安全例外。我通过复制我的代码来解决这个问题:(。我使用嵌套的sx:div预加载,当它完成时,它会通过启动计时器通知div。非常奇怪。
答案 1 :(得分:0)
不使用技巧,您可以使用Struts2 jQuery插件,只需导入库并将标记从sx:更改为sj: