Re: how do I specify function parameters in the URL
Paul Joseph <pjoseph <at> gmail.com>
2012-01-03 14:36:08 GMT
Ah...yes, got it, thanks!
Paul
On 1/3/2012 9:25 AM, Robby Pelssers wrote:
> Not sure if your setup is working like the sample below, but you can easily pass a parameter which you
extract from the URI or just pass a request parameter
>
> Example 1:
> <map:match pattern="login/*">
> <map:call function="showIndexPage">
> <map:parameter name="paramName" value="{1}"/>
> </map:call>
> </map:match>
>
>
> Example 2:
>
> <map:match pattern="login.html">
> <map:call function="showIndexPage">
> <map:parameter name="paramName" value="{request-param:userId}"/>
> </map:call>
> </map:match>
>
>
> Kind regards,
> Robby
>
> -----Original Message-----
> From: Paul Joseph [mailto:pjoseph <at> gmail.com]
> Sent: Tuesday, January 03, 2012 3:19 PM
> To: users <at> cocoon.apache.org
> Subject: how do I specify function parameters in the URL
>
> Hi there,
>
> I know that I can call a function with parameters using the sitemap as
> for ex.:
>
> <map:flow language="javascript">
> <map:script src="myApplication.js"/>
> </map:flow>
> <map:pipelines>
> <map:pipeline>
> <map:match pattern="index.html">
> <map:call function="showIndexPage">
> <map:parameter name="paramName" value="Value"/>
> </map:call>
> </map:match>
> </map:pipeline>
> </map:pipelines>
>
> and:
>
> Then in myApplication.js you would define a JavaScript function called
> showIndexPage() such as:
>
> function showIndexPage() { var param = cocoon.parameters.paramName;
> sendPage("private/index.html", {param: param}); }
>
>
>
> But how would I use this to call a function whose arguments are in the
> calling URL.
>
> Ex. say I wanted to login any user where the user's name is specified in
> the URLhow could I do this? For example if I wanted to call a function
> using the user's login name that I specify in the URL (say the user is
> jsmith), and I used a URL as below, how would I pass on jsmith on to the
> flowscript?:
>
> Ex.: http://myserver:8080/myApp/login/jsmith
>
> thx.
> Paul
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
>
>