The above example uses the method, and there are also methods for boolean
, long
, , short
and so on. Each of these methods is null-safe and safe from any parsing errors, so you don’t have to perform any additional checks on the parameters.
These same type conversion methods are also available on the attrs
parameter of GSP tags.
Handling Multi Parameters
In this case dealing with one parameter and dealing with many has different semantics since Groovy’s iteration mechanics for String
iterate over each character. To avoid this problem the params object provides a list
method that always returns a list: