You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sergio Sánchez González <se...@gmail.com> on 2008/10/28 17:28:41 UTC

Problem publishing/subcribing events with dojo and struts

I'm using struts and dojo. My code works fine until I change the
struts namespace.

These are my actions:

   <package name="expedient" extends="struts-default">

               <action name="showExpedients">
                       <result>pages/expedient/Expedient.jsp</result>
               </action>

               <action name="listExpedients"
class="expedientController" method="execute">
                       <result>pages/expedient/ExpedientList.jsp</result>
               </action>

              <action name="showLines" class="expedientController"
method="getLines">
                  <result>pages/expedient/ExpedientLinesList.jsp</result>
       </action>
   </package>

   I have the main page Expedient.jsp, a page for listing expedients
ExpedientsList.jsp and another one for listing the lines of the
expedients ExpedientLinesList. This works fine, if I publish an event
in ExpedientList.jsp it can be captured in Expedient.jsp.

   But when I change the struts namespace:

   <package name="expedient" extends="struts-default" namespace="/expedient">

               <action name="showExpedients">
                       <result>/pages/expedient/Expedient.jsp</result>
               </action>

               <action name="listExpedients"
class="expedientController" method="execute">
                       <result>/pages/expedient/ExpedientList.jsp</result>
               </action>

             <action name="showLines" class="expedientController"
method="getLines">
                       <result>/pages/expedient/ExpedientLinesList.jsp</result>
           </action>
   </package>

     the following notification inside ExpedientList.jsp doesn't call
the subscription in Expedient.jsp

     notify code in ExpedientList.jsp:
         <s:a href="%{viewLinesUrl}" theme="ajax"
targets="expedientLines" notifyTopics="/openLineList">View All
Messages</s:a>

     subscrition code in Expedient.jsp:
               dojo.event.topic.subscribe("/openLineList",
function(data, type, request){ my code...});

    The only difference I see is that when the namespace is used in
struts I have to write the absolute path in the <result> tags. But I
don't fully understand how this affect the events in dojo and how to
solve it. I don't see the light.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem publishing/subcribing events with dojo and struts

Posted by Musachy Barroso <mu...@gmail.com>.
Overall it is not a good idea to link an anchor and a div and make it both
"ajax"-enabled. You can either publish a topic on the anchor and listen to
it on the div (without targets in the anchor), or make the div plain, and
use targets in the anchor.

musachy

On Wed, Oct 29, 2008 at 5:45 AM, Sergio Sánchez González <sergiosg@gmail.com
> wrote:

> Thanks in advance for the feedback.
>
> It's changed but doesn't work. This is the url tag and the link in the
> ExpedientList.jsp
>
>        <s:url id="viewLinesUrl" action="showLines" namespace="/expedient">
>                        <s:param name="expedientId" value="id" />
>        </s:url>
>
>         <s:a href="%{viewLinesUrl}" theme="ajax"
> targets="expedientLines" notifyTopics="/openLineList">View All
> Messages</s:a>
>
> And this is the div which receives the data in the Expedient.jsp:
>
>                <s:url action="showLines" id="listExpLinesUrl"
> namespace="/expedient"/>
>
>                <div id="expedientLinesWrapper" style="width:
> 550px;border-style: solid; display:none">
>                        <s:div id="expedientLines" theme="ajax"
> href="%{listExpLinesUrl}" loadingText="Loading..."
> listenTopics="/viewLines" notifyTopics="/closeLineList"/>
>                </div>
>
> The response is ok, I mean, the data is retreived from de server side.
> But the openLineList trigger fails. So I have no way to make visible
> the expedientLinesWrapper div.
>
>
>
> 2008/10/28 Musachy Barroso <mu...@gmail.com>:
> > Make sure that you updated the url tags(add or change namespace) used to
> > build the url for the ajax request, in this case "viewLinesUrl".
> >
> > musachy
> >
> > On Tue, Oct 28, 2008 at 12:28 PM, Sergio Sánchez González <
> > sergiosg@gmail.com> wrote:
> >
> >> I'm using struts and dojo. My code works fine until I change the
> >> struts namespace.
> >>
> >> These are my actions:
> >>
> >>   <package name="expedient" extends="struts-default">
> >>
> >>               <action name="showExpedients">
> >>                       <result>pages/expedient/Expedient.jsp</result>
> >>               </action>
> >>
> >>               <action name="listExpedients"
> >> class="expedientController" method="execute">
> >>                       <result>pages/expedient/ExpedientList.jsp</result>
> >>               </action>
> >>
> >>              <action name="showLines" class="expedientController"
> >> method="getLines">
> >>                  <result>pages/expedient/ExpedientLinesList.jsp</result>
> >>       </action>
> >>   </package>
> >>
> >>   I have the main page Expedient.jsp, a page for listing expedients
> >> ExpedientsList.jsp and another one for listing the lines of the
> >> expedients ExpedientLinesList. This works fine, if I publish an event
> >> in ExpedientList.jsp it can be captured in Expedient.jsp.
> >>
> >>   But when I change the struts namespace:
> >>
> >>   <package name="expedient" extends="struts-default"
> >> namespace="/expedient">
> >>
> >>               <action name="showExpedients">
> >>                       <result>/pages/expedient/Expedient.jsp</result>
> >>               </action>
> >>
> >>               <action name="listExpedients"
> >> class="expedientController" method="execute">
> >>
> <result>/pages/expedient/ExpedientList.jsp</result>
> >>               </action>
> >>
> >>             <action name="showLines" class="expedientController"
> >> method="getLines">
> >>
> >> <result>/pages/expedient/ExpedientLinesList.jsp</result>
> >>           </action>
> >>   </package>
> >>
> >>     the following notification inside ExpedientList.jsp doesn't call
> >> the subscription in Expedient.jsp
> >>
> >>     notify code in ExpedientList.jsp:
> >>         <s:a href="%{viewLinesUrl}" theme="ajax"
> >> targets="expedientLines" notifyTopics="/openLineList">View All
> >> Messages</s:a>
> >>
> >>     subscrition code in Expedient.jsp:
> >>               dojo.event.topic.subscribe("/openLineList",
> >> function(data, type, request){ my code...});
> >>
> >>    The only difference I see is that when the namespace is used in
> >> struts I have to write the absolute path in the <result> tags. But I
> >> don't fully understand how this affect the events in dojo and how to
> >> solve it. I don't see the light.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: Problem publishing/subcribing events with dojo and struts

Posted by Sergio Sánchez González <se...@gmail.com>.
Thanks in advance for the feedback.

It's changed but doesn't work. This is the url tag and the link in the
ExpedientList.jsp

	<s:url id="viewLinesUrl" action="showLines" namespace="/expedient">
			<s:param name="expedientId" value="id" />
	</s:url>

         <s:a href="%{viewLinesUrl}" theme="ajax"
targets="expedientLines" notifyTopics="/openLineList">View All
Messages</s:a>

And this is the div which receives the data in the Expedient.jsp:

	        <s:url action="showLines" id="listExpLinesUrl" namespace="/expedient"/>
	
	        <div id="expedientLinesWrapper" style="width:
550px;border-style: solid; display:none">
	    		<s:div id="expedientLines" theme="ajax"
href="%{listExpLinesUrl}" loadingText="Loading..."
listenTopics="/viewLines" notifyTopics="/closeLineList"/>
	        </div>

The response is ok, I mean, the data is retreived from de server side.
But the openLineList trigger fails. So I have no way to make visible
the expedientLinesWrapper div.



2008/10/28 Musachy Barroso <mu...@gmail.com>:
> Make sure that you updated the url tags(add or change namespace) used to
> build the url for the ajax request, in this case "viewLinesUrl".
>
> musachy
>
> On Tue, Oct 28, 2008 at 12:28 PM, Sergio Sánchez González <
> sergiosg@gmail.com> wrote:
>
>> I'm using struts and dojo. My code works fine until I change the
>> struts namespace.
>>
>> These are my actions:
>>
>>   <package name="expedient" extends="struts-default">
>>
>>               <action name="showExpedients">
>>                       <result>pages/expedient/Expedient.jsp</result>
>>               </action>
>>
>>               <action name="listExpedients"
>> class="expedientController" method="execute">
>>                       <result>pages/expedient/ExpedientList.jsp</result>
>>               </action>
>>
>>              <action name="showLines" class="expedientController"
>> method="getLines">
>>                  <result>pages/expedient/ExpedientLinesList.jsp</result>
>>       </action>
>>   </package>
>>
>>   I have the main page Expedient.jsp, a page for listing expedients
>> ExpedientsList.jsp and another one for listing the lines of the
>> expedients ExpedientLinesList. This works fine, if I publish an event
>> in ExpedientList.jsp it can be captured in Expedient.jsp.
>>
>>   But when I change the struts namespace:
>>
>>   <package name="expedient" extends="struts-default"
>> namespace="/expedient">
>>
>>               <action name="showExpedients">
>>                       <result>/pages/expedient/Expedient.jsp</result>
>>               </action>
>>
>>               <action name="listExpedients"
>> class="expedientController" method="execute">
>>                       <result>/pages/expedient/ExpedientList.jsp</result>
>>               </action>
>>
>>             <action name="showLines" class="expedientController"
>> method="getLines">
>>
>> <result>/pages/expedient/ExpedientLinesList.jsp</result>
>>           </action>
>>   </package>
>>
>>     the following notification inside ExpedientList.jsp doesn't call
>> the subscription in Expedient.jsp
>>
>>     notify code in ExpedientList.jsp:
>>         <s:a href="%{viewLinesUrl}" theme="ajax"
>> targets="expedientLines" notifyTopics="/openLineList">View All
>> Messages</s:a>
>>
>>     subscrition code in Expedient.jsp:
>>               dojo.event.topic.subscribe("/openLineList",
>> function(data, type, request){ my code...});
>>
>>    The only difference I see is that when the namespace is used in
>> struts I have to write the absolute path in the <result> tags. But I
>> don't fully understand how this affect the events in dojo and how to
>> solve it. I don't see the light.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Problem publishing/subcribing events with dojo and struts

Posted by Musachy Barroso <mu...@gmail.com>.
Make sure that you updated the url tags(add or change namespace) used to
build the url for the ajax request, in this case "viewLinesUrl".

musachy

On Tue, Oct 28, 2008 at 12:28 PM, Sergio Sánchez González <
sergiosg@gmail.com> wrote:

> I'm using struts and dojo. My code works fine until I change the
> struts namespace.
>
> These are my actions:
>
>   <package name="expedient" extends="struts-default">
>
>               <action name="showExpedients">
>                       <result>pages/expedient/Expedient.jsp</result>
>               </action>
>
>               <action name="listExpedients"
> class="expedientController" method="execute">
>                       <result>pages/expedient/ExpedientList.jsp</result>
>               </action>
>
>              <action name="showLines" class="expedientController"
> method="getLines">
>                  <result>pages/expedient/ExpedientLinesList.jsp</result>
>       </action>
>   </package>
>
>   I have the main page Expedient.jsp, a page for listing expedients
> ExpedientsList.jsp and another one for listing the lines of the
> expedients ExpedientLinesList. This works fine, if I publish an event
> in ExpedientList.jsp it can be captured in Expedient.jsp.
>
>   But when I change the struts namespace:
>
>   <package name="expedient" extends="struts-default"
> namespace="/expedient">
>
>               <action name="showExpedients">
>                       <result>/pages/expedient/Expedient.jsp</result>
>               </action>
>
>               <action name="listExpedients"
> class="expedientController" method="execute">
>                       <result>/pages/expedient/ExpedientList.jsp</result>
>               </action>
>
>             <action name="showLines" class="expedientController"
> method="getLines">
>
> <result>/pages/expedient/ExpedientLinesList.jsp</result>
>           </action>
>   </package>
>
>     the following notification inside ExpedientList.jsp doesn't call
> the subscription in Expedient.jsp
>
>     notify code in ExpedientList.jsp:
>         <s:a href="%{viewLinesUrl}" theme="ajax"
> targets="expedientLines" notifyTopics="/openLineList">View All
> Messages</s:a>
>
>     subscrition code in Expedient.jsp:
>               dojo.event.topic.subscribe("/openLineList",
> function(data, type, request){ my code...});
>
>    The only difference I see is that when the namespace is used in
> struts I have to write the absolute path in the <result> tags. But I
> don't fully understand how this affect the events in dojo and how to
> solve it. I don't see the light.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd