This is Possum - a stupid little test of JSR-223 in a web application. I was able to get it working with Groovy, Python (Jython) and Ruby (JRuby).
The script engine initilizes a variable called PEOPLE
for
you (in Ruby, this is a global variable, so it's called $PEOPLE
).
for p in PEOPLE:
println "%s %s" % (p.surname, p.givenName)
for (i = 0; i < PEOPLE.size(); i++) {
println(PEOPLE.get(i).surname);
}
PEOPLE.each { p ->
println "${p.surname} ${p.givenName}"
}
$PEOPLE.each do|p|
puts "#{p.surname}, #{p.givenName}"
end