cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: expected behaviour: global vars in flowscript
Date Wed, 03 Aug 2005 14:21:07 GMT
Berin Loritsch wrote:
> Leszek Gawron wrote:
> 
>> If you are trying to apply MVC here you're failing. You should not be 
>> calling pages/displayHome.xsp but some displayHome flowscript function.
>>
>> The flowscript function prepares the bean and does cocoon.sendPage( 
>> "pages/displayHome" ) which is matched to:
>>
>> >             <map:match pattern="pages/displayHome.xsp">
>> >                 <map:aggregate element="page">
>> >                     <map:part src="cocoon:/header.xsp"/>
>> >                     <map:part src="cocoon:/pages/showFoo"/>
>> >                     <map:part src="cocoon:/footer.xsp"/>
>> >                 </map:aggregate>
>> >             </map:match>
>>
>> >             <map:match pattern="pages/showFoo">
>> >                 <map:generate src="bean.jx" type="jx"/>
>> >                 <map:serialize type="xml"/>
>> >             </map:match>
>>
>> It means:
>>
>> 1. you invoke the controller
>> 2. the controller performs business logic and prepares data for view
>> 3. with cocoon.sendPage you call your view
>>
>> In your case it is all pretty mixed up.
> 
> 
> 
> So how would you fix it, assuming we wanted to aggregate different 
> pieces into one page?  Those peaces are used elsewhere in the program.  
> Your comments weren't particularly helpful to either point to the 
> specifics of how to expect flowscript to work or how to correct the code 
> as it is.
> 
> Seon's on my team, so I have a vested interest in getting this issue 
> resolved.
let me see:

function login() {
     setupMyFoo();
     home();
}

function home() {
     var foo = accessTheFoo();
     cocoon.sendPage( "displayHome", { bean: foo } );
}

and now the sitemap:
<map:match pattern="displayHome">
     <map:aggregate element="page">
         <map:part src="cocoon:/header.xsp"/>
         <map:part src="cocoon:/showBean"/>
         <map:part src="cocoon:/footer.xsp"/>
     </map:aggregate>
</map:match>

<map:match pattern="showBean">
     <map:generate src="bean.jx" type="jx"/>
     <map:serialize type="xml"/>
</map:match>

<map:match pattern="login">
     <map:call function="login"/>
</map:match>

<map:match pattern="home">
     <map:call function="home"/>
</map:match>

Sorry if I sounded rude at first.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message