You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Guillote <gu...@dequo.com> on 2007/05/28 06:07:31 UTC
Problem to subscribe a topic when trying to subscribe from an ajax
called page.
What am i trying to do?
-I need to publish a topic (dojo.event.topic.publish) on the event onchange
of a select tag.
The workflow is:
-First i access an action that prints index.jsp page.
-Then from that index.jsp i have a link (ajax) that loads an action in a
div (id="myCalendarDiv")
-This loads mycalendar.jsp in the div myCalendarDiv
-In that page i have another ajax link that loads mycalendar_planner.jsp.
This last page "mycalendar_planner.jsp" has a s:select tag.
In the onchange event, it tries to publish a topic
"updateReportsListTopic".
Now the problem:
-If i susbscribe the topic in the first page "index.jsp" (the only page
that wasn't call by ajax), it works.
-But if i try to subscribe the topic in the mycalendar_planner.jsp (it
doesn't works).
The problem is that i need to subscribe the topic in this last page.
If somebody has any idea of what can be wrong, or how to solve, i would
really appreciate, cause i already tried everything, and searched all the
web without results.
Thanks in advance!!
Guillermo
I attached some code from 3 jsp files mentioned for reference:
-the links <s:a>
-the subscription method
-the publish method
index.jsp
<s:head theme="ajax" debug="true" calendarcss="calendar-green" />
<script language="JavaScript" type="text/javascript" src="dojo.js"></script>
<script type="text/javascript">
function updateReports() {
alert('hola');
}
dojo.event.topic.getTopic("updateReportsListTopic").subscribe(null,
"updateReports");
</script>
<s:url id="urlMyCalendar" action="MyCalendar.action" />
<s:a href="%{urlMyCalendar}" targets="myCalendarDiv" theme="ajax"
notifyTopics="/myCalendarDayTopic">
My Calendar
</s:a>
mycalendar.jsp
<s:url id="urlPlanner" action="MyCalendar!planner.action"></s:url>
<s:a href="%{urlPlanner}" theme="ajax" targets="myCalendarMain"
executeScripts="true">
pic/button/planner_calendar.png
</s:a>
mycalendar_planner.jsp
<s:head theme="ajax" debug="true" calendarcss="calendar-green" />
<script type="text/javascript">
function updateReports() {
alert('hola');
}
dojo.event.topic.getTopic("updateReportsListTopic").subscribe(null,
"updateReports");
</script>
<s:url id="urlPlanner" action="MyCalendar!planner.action"></s:url>
<s:a id="anchorPlanner" href="%{urlPlanner}" theme="ajax"
targets="myCalendarMain"></s:a>
<s:select label="Month" name="calView.selectedMonth" list="calView.months"
onchange="dojo.event.topic.publish('updateReportsListTopic' );alert('j2'); "
/>
--
View this message in context: http://www.nabble.com/Problem-to-subscribe-a-topic-when-trying-to-subscribe-from-an-ajax-called-page.-tf3825935.html#a10830940
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org