Upayavira
I do appreciate the detailed explanation. It does help... up
to a point. I assume that the PetStore example will be rewritten
in future versions (I am still on 2.15) so it does not rely on this
deprecated approach. In that case, I guess I will need to update
my app accordingly.
In the meantime, I need to figure how why main() does not
receive the name of the function called in *.do . Could it be the
fact that it is called inside of a protected match:
<map:match pattern="*.do">
<map:act type="auth-protect">
<map:parameter name="handler" value="myhandler"/>
<map:call function="main">
<map:parameter name="page" value="{1}"/>
</map:call>
</map:act>
<map:redirect-to uri="login"/>
</map:match>
and, if so, how do then access the value.
Otherwise I cannot figure out *why* funName is null??
Thanks
Derek
>>> [EMAIL PROTECTED] 2005/11/02 03:23:12 PM >>>
Derek Hohls wrote:
> I am trying to get a handle on a key function in the PetStore example;
> the sitemap handles a call to any function in the sample as follows:
>
> <map:match pattern="*.do">
> <map:call function="main">
> <map:parameter name="page" value="{1}"/>
> </map:call>
> </map:match>
>
> in the petstore.js code, there is the corresponding match:
>
> function main(funName) {
> var fun = this[funName];
> ...
> }
That method of defining parameters for flowscript functions relies upon
the order of the parameters within the sitemap, and has therefore been
deprecated. You are recommended to use the cocoon.parameters approach
instead. However, all you are doing, in effect, is setting funName to
whatever {1} was.
> when I use the Rhino JavaScript debugger, it shows clearly
> that the value of "funName" in the main(funName) is that of
> the function being called. However, it is not clear as to where/
> how that value becomes associated with the function parameter.
>
> In my application, where I try the same type of code, I end up
> with a null value for "funName"... but I cannot see where/how
> to get the right value in there.
So, funName is the name of a function. As functions are defined within
the current scope (this), this[funName] gets you the function with that
name. Note, it doesn't execute it. You can now execute that function
with fun(), or fun(some, set, of, parameters);
> Any help would be appreciated.
Does that help?
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their
support.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]