On 18 Dec 2014 at 22:10:54, Bryn Jeffries
(bryn.jeffries@sydney.edu.au(mailto:bryn.jeffries@sydney.edu.au)) wrote:
Why does a page containing just the following produce
no output?:
{{groovy}}
class Callee {
void hello() {
println "hello, world"
}
}
c = new Callee()
c.hello()
{{/groovy}}
Actually this is a good question! I don’t know…
I’ve tried it in the groovy web console and it works so it’s something specific to the way
XWiki uses Groovy. Could be because that we use the Scripting API (JSR 223) to access
Groovy.
It probably means that the output is not wired when inside the class scope but I’m not
sure why…
The method is invoked for since the following works fine:
{{groovy}}
class Callee {
String hello() {
return "hello, world"
}
}
c = new Callee()
println c.hello()
{{/groovy}}
If someone has an idea…
Thanks
-Vincent
I have programming rights, and running scripts in
general works fine. It's just when I try to invoke a method from a locally defined
class that I hit problems.