views:

298

answers:

1

I am publishing with dojo topics:

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

And in JSP I have 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>

The problem is, that my action is published twice and I have no clue why.

+1  A: 

I had the same problem with struts you have to disconnect the trigger after it was fired, and it will be reconfigured by the div content refresh.

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>
Zenithar
Thanks a lot! This saved me a lot of work!
Trick