other register

Wednesday, January 14, 2009

Redirect Params in Grails

Grails params contain controller, action, and other parameters like below:

["_action_search":"Search", "choice":"Locker Register", "action":"search", "numb
er":"1", "controller":"lockerRegister"]

So when doing redirect with all the params like below:

class JetController {

def search = {

redirect (action: "jetAction", params: params)

def jetAction { 
// some code here

It might be in a endless redirect loop. A workaround is to manually specify the parameters your want to redirect. For example: 

redirect (action: "testAction", controller: "testController", params:[p1: 'value1', p2: 'value2']) 

No comments: