Struts2 sx:div 与计时器忽略预加载 =“true”
我有以下刷新计时器:
<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" />
我遇到的问题是,即使我有 preload="true",它也会在加载内容之前等待 8000 毫秒。 此后,它的功能正如我所期望的那样,每 8000 毫秒重新加载一次内容。 删除 updateFreq="8000" 会导致 div 正确预加载,但我的计时器不会启动。
这是预期的行为吗? 如果是这样,有解决方法吗?
我曾经通过在 sx:div 标签内嵌入 html 来解决这个问题,但 Firefox 3.5 现在使用这种方法会引发安全错误,因为 html 包含表单,并且 ajax 试图在其之上写入。
I have the following refreshing timer:
<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" />
The problem I have is that it waits 8000 millis before loading the content even though I have preload="true". After this it functions as I would expect, reloading the content every 8000 millis. Removing updateFreq="8000" causes the div to preload correctly but then my timer does not start.
Is this expected behaviour? If so is there a workaround?
I used to get around this by embedding html inside the sx:div tag, but Firefox 3.5 now throws security errors with this approach due to the the html containing a form, and the ajax trying to write over the top of it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎没有人有答案,我用以下方法解决了这个问题,
在最新的 Firefox 中,它似乎因安全异常而失败。 我通过复制我的代码来解决这个问题:(。我预加载了嵌套的 sx:div ,完成后它会通知 div 并启动计时器。非常奇怪。
Seem like nobody has an answer, I worked around this with the following
It seemed to be failing with a security exception in the latest firefox. I worked around it by duplicating my code :(. I preload with the nested sx:div and when that is finished it notifies the div with a timer to start. Very strange.
无需使用技巧,您可以使用 Struts2 jQuery 插件,只需导入库并将标签从 sx: 更改为 sj:
这里是一个例子
Without using trick, you can use the Struts2 jQuery Plugin, you just need to import the library and to change your tag from sx: to sj:
An example here