Forum Discussion

ramchalluri's avatar
ramchalluri
Occasional Contributor
16 years ago

How to use Global Vairables in Groovy.

Hi,

I am sure its a very easy thing to do but I am kind of stuck with not being able to use Global Variables from the groovy script.

I am able to access the same variable from the request objects e.g. ${#Global#test.property} but when I tried to do the same thing in Groovy script i get the following error.

log.info ("12312321" + ${#Global#level0.prop});


"org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 1: unexpected char: '#' @ line 1, column"

Cheers,
Ram Challuri
  • ramchalluri's avatar
    ramchalluri
    Occasional Contributor
    I got the answer. Sorry to bother.

    def x = context.expand( '${#Global#test.property}' )