Evaluate dynamic code (string), add and retrieve parameters

By neokrates, written on June 3, 2010

groovy   snippet

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 245 views
Rate it
Ad
Poll
  • Which frameworks do you use to test your web frontend?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
1
2
3
4
5
def binding = new Binding(name: 'Neokrates')
def shell = new GroovyShell(binding)
def expression = "print 'your name is ' +name; name = 'anonymous' "
   shell.evaluate(expression)
   print "name was changed to: " + binding.getVariable("name")
Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 0 votes)
0 votes 'YES'  0 votes 'NO'
TAGS
No tags for this post.
RELATED
Pages
Posts
SOCIAL
Be Sociable, Share!

Leave a Reply