Hi Lewis,
Maybe this will help:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/GroovyClassHelloWorldTuto…
In the shown example there are objects passed from Velocity to Groovy.
-Vincent
On Jul 15, 2009, at 5:30 PM, Lewis Denizen wrote:
Hi xwiki-users,
I have a simple macro defined in velocity:
{{velocity}}
{{{
#macro( addDate $timeZone $date )
#set( $script = "
tz = '$timeZone'
date = '$date'
timezone = java.util.TimeZone.getTimeZone( timezone )
cal = java.util.Calendar.getInstance( timezone )
// etc...
" )
#set( $runnable = $xwiki.parseGroovyFromString( $script ) )
$runnable.run()
#end
}}}
{{/velocity}}
Currently, the velocity macro parameters $timeZone and $date have to
be
Strings. I want to be able to pass "real objects" rather than just
strings
into the groovy script, though. I can easily return an Object back
into
Velocity space by returning from the groovy script, but is there a
way to go
the other way around? I guess what I really need is some "context"
object
shared by groovy and Velocity...
Thanks in advance!