Hello,
 
the following vtl does not render what is, IMHO, expected :
 
#macro(testEval $expr)

    #foreach($value in ["val1", "val2"])
        value is : #evaluate( $expr )
    #end
#end

#testEval( "${value}" )

renders :

value is : ${value}
value is : ${value}

The reason is that EvaluateContext ctor assigns 'inner.getBaseContext()'
to instance variable 'innerContext', and getBaseContext() does not
return VMContext localContext refs (of the #foreach directive).

Changing the EvaluateContext ctor so that 'innerContext' is set to
'inner' allow velocity to render the right result :

value is : val1
value is : val2

But I'm not sure this would be a correct fix, should the VMContext
return all current refs ? Could you tell me what the normal behavior is
and what is the way all that stuff sould work ?

Aside, I noticed in 1.6 UG documentation, that the example for #evaluate
directive taking a reference parameter uses the #include directive.

Thank you !

Etienne Massip


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to