vikas
vikas

Reputation: 1506

how to redirect request in grails

When I redirect to another action in the same controller the 'request' is null.

def updateEmployee() {
        println "updateEmployee(): request =" + request.JSON
        redirect(action: "createEmployee", params: params)
}


def createEmployee() {
    def renderStatus = 500;
    System.out.println "createEmployee() : request= " + request.JSON;

the updateEmployee prints all the request data, but creteEmployee prints it as null ([:])

How to redirect the 'request' (I mean the POST data ) ?

Upvotes: 2

Views: 1041

Answers (1)

Igor Artamonov
Igor Artamonov

Reputation: 35961

You cannot redirect POST request. Redirect mean a new GET request, so all previous data from previous request will be lost.

If you need to call another action without actual redirect use forward: http://grails.org/doc/latest/ref/Controllers/forward.html

Upvotes: 6

Related Questions