Struts2 sx:div 与计时器忽略预加载 =“true”

发布于 2024-07-29 03:05:47 字数 794 浏览 5 评论 0原文

我有以下刷新计时器:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心病无药医 2024-08-05 03:05:47

似乎没有人有答案,我用以下方法解决了这个问题,

<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 并启动计时器。非常奇怪。

Seem like nobody has an answer, I worked around this with the following

<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>

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.

羅雙樹 2024-08-05 03:05:47

无需使用技巧,您可以使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文