import java.text.SimpleDateFormat import com.barneyb.Person sdf = new SimpleDateFormat("yyy/MM/dd") sdf.lenient = true variables.myPerson = new Person([ name: attributes.name ?: "Barney", dob: sdf.parse(attributes.dob ?: "1980/06/10") ])

Simple Objects

Here we have the combination of a managed runtime with a Groovy path and some inline Groovy. The path in this case is used to house the com.barneyb.Person class, which the inline script instantiates and configures.

Also on show is the transparent scope access within Groovy scripts and use of Java APIs.

Output

#myPerson.name# is #numberFormat(myPerson.ageInYears, ",0.00")# years old (thats #numberFormat(myPerson.ageInDays, ",")# days!).



Enter your own info to learn about your age:

value="#url.name#" />
value="#url.dob#" /> yyyy/mm/dd