On Mon, Dec 19, 2011 at 1:01 PM, Eugen Colesnicov <ecolesnicov(a)gmail.com> wrote:
Hi everybody!
I need help to organize interacting beetween groovy and velocity script on a
page. I need to transmit a value of a parameter from groovy script - to
velocity script (both scripts placed on one page).
I know theory, that need to use xcontext:
xcontext.put("variable","value") inside groovy script
and $xcontext.get("variable") inside velocity script
but in my situation - this doesn't work ... I cannot understand, what object
in my groovy script representing xcontext object ...
As a groovy script, I am using "Title Post Processing Using Groovy" based on
event listener technology, originally taken from here
http://extensions.xwiki.org/xwiki/bin/view/Extension/Title+Post+Processing+….
I only made small changes on this script (calculates title according to my
properties). It works perfectly.
Also, I inserted on same page (where event listener script was placed) one
more script - velocity script (below groovy script). My idea - when an event
was happen - should execute 2 scripts. And all is working perfectly! Execute
and "Title Post Processing Using Groovy" and my own velocity-script - this
part working without any problems.
What change did you make exactly ? Could you paste your new scripts ?
I need to make small next step - to transmit a value of a parameter (page
name where an event was happens) from groovy to velocity. But if I try to
write inside this groovy script:
xcontext.put("eventsource",source.getFullName()) - event listener stops
working ... (looks like some error)
What error do you get exactly ?
If I trying to use (as a xcontext) - crtContext (variable which defines some
context-related object in this script) - event listener working, but when I
trying inside velocity-script to get:
$xcontext.get("eventsource") - value is empty ...
As a result - my question is - how need to use xcontext.put(... in this
groovy script of event listenter which I am using and how I can get xcontext
variable in a below-placed velocity script (which is also executes)?
If will be small example - will be perfectly, because I am not groovy- or
java-programmer and have some difficulties of understanding object-oreiented
organization of xwiki ...
--
Thanks beforehand!
Eugen Colesnicov
--
View this message in context:
http://xwiki.475771.n2.nabble.com/Interacting-between-groovy-velocity-scrip…
Sent from the XWiki- Users mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne