Grails 2.x added a new method in params object “list”. This method is used in case you are not sure weather you got a string(single request parameters of a name) or a list(multiple request parameters of the same name) in params. This method always return a list. This method convert string params to list.
syntax
params.list('parameter_name')
eg. if request is
../controller/action?testData=A&testData=B
then
params.list('testData')
gives
['A', 'B']
and if request is
../controller/action?testData=A
then
params.list('testData')
gives
['A']
and if request is
../controller/action
then
params.list('testData')
gives a empty list []
Recent Comments