【问题标题】:Struts2 and Dojo (double?) publishStruts2 和 Dojo(双重?)发布
【发布时间】:2009-12-15 15:27:08
【问题描述】:

我正在发布道场主题:

dojo.event.topic.publish("publishThisTarget");

在 JSP 中我有 listenTopics:

<s:url var="url2publish" action="MyAction" namespace="/public" />
    <sx:div showLoadingText="false" indicator="ajaxIndicator"
        id="content" href="%{url2publish}" theme="ajax"
        listenTopics="publishThisTarget" preload="false"
                    afterNotifyTopics="/ajaxAfter">
</sx:div>

问题是,我的操作被发布了两次,我不知道为什么。

【问题讨论】:

    标签: struts2 dojo publishing publish-subscribe


    【解决方案1】:

    我在使用 struts 时遇到了同样的问题,您必须在触发后断开触发器,并且它将通过 div 内容刷新重新配置。

    Javascript:

    dojo.event.topic.subscribe("/clearMsg", function(date, type, request) {
        dojo.event.topic.destroy('publishThisTarget');
    });
    

    JSP:

    <s:url var="url2publish" action="MyAction" namespace="/public" />
        <sx:div showLoadingText="false" indicator="ajaxIndicator"
                id="content" href="%{url2publish}" theme="ajax"
                listenTopics="publishThisTarget" preload="false"
                beforeNotify="/clearMsg" afterNotifyTopics="/ajaxAfter">
    </sx:div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-19
      • 1970-01-01
      • 1970-01-01
      • 2012-12-24
      • 1970-01-01
      • 1970-01-01
      • 2011-01-26
      相关资源
      最近更新 更多