Struts2 and Dojo (double?) publish
-
19-09-2019 - |
Question
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.
Solution
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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow