Ugo suggested: > <map:match pattern="*/profile/edit"> > <map:call function="dumpData"/> > </map:match> > > <map:match pattern="view"> > <map:generate src="cocoon://generate"/> > <map:transform src="homePage.xsl"/> > <map:serialize/> > </map:match> > > function dumpData() { > dumpUserData(); > dumpOrderData(); > dumpNewsItems(); > cocoon.sendPage("view"); > } >
The main problem I have with this approach is that without looking at the script code, there is no easy way of telling that the first match will end up calling the second one and so the flow of the application becomes more opaque...and thus harder to understand and maintain. I like Tim's approach much better....where everything is in one place and the high level flow of control is quite clear and transparent. also glad to see that I am not the only one that has used this paradigm. <grins> An action that will call a flowscript for you without the sendPage restriction would seem to be a reasonable alternative, in which case Tony's code then looks like: <map:match action="*/profile/edit"> <map:act type="FlowscriptAction" function="dumpUserData"> <map:call function="dumpOrderData"/> <map:call function="dumpNewsItems"/> <map:generate src="cocoon://generate"/> <map:transform src="homePage.xsl"/> <map:serialize/> </map:act> ... error stuff can go here... </map:match> Which I like even better...since you have the ability to branch the flow based on success/failure of the action. You could also allow parameters as input to the function by doing something like: <map:act type="FlowscriptAction" function="dumpUserData"> <map:parameter value="xxx"/> <!-- name attribute could be ignored --> <map:parameter value="yyy"/> .... as before where the method signature of dumpUserData would look like function dumpUserData( xValue, yValue ) {....} Clean...crisp...understandable...functional....and doesn't clutter the architecture. +1 from me for the FlowscriptAction approach and soon too! Andrzej Jan Taramina Chaeron Corporation: Enterprise System Solutions http://www.chaeron.com