cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <>
Subject FlowScript Parameters, Re: How to access sitemap parameter within JavaFlow?
Date Fri, 05 Nov 2004 13:13:33 GMT
Sylvain Wallez wrote:
> Michael Gerzabek wrote:
>> Of course you can do. When you declare a sitemap flow function call 
>> like above your flow method must be declared like
>> function myJavaFlowMethod( foo ) {
>> }
>> and a "print( foo );" within this method should show "bar" in your 
>> Console.
> I strongly suggest you *do not use it this way*, as it is highly 
> misleading: <map:parameter> are name/value associations whereas JS 
> function parameters are only positional, which means the "foo" you write 
> in the function declaration has absolutely no relation with the "foo" in 
> <map:parameter>.


> I've been wanting to remove forbid this for a long time, but didn't knew 
> how to identify JS functions with parameters, in order to issue a proper 
> error message if this buggy construct is used. Looking a bit closer to 
> Rhino, I now found it: NativeFunction has a getArity() method which is 
> the number of parameters. We could then raise an error if getArity() != 0.
> What do people think?

IMHO, write ERROR in the log in 2.1.6, throw exception in 2.1.7, remove any 
traces of this in 2.2. Too draconian? :)


View raw message