Reputation: 25
I have a controller in my grails 3.2.9 project that was created using the generate-controller command. I would like to change the default view that gets rendered after the update() method in the controller is called. It defaults to rendering the show.gsp, but I would like it to render a custom gsp. Is it possible to change this behavior? I've tried changing the last line of the update() method to:
'*'{ respond BOSI, [status: OK, view: 'myView'] }
but the show.gsp continues to get rendered. I'm fairly new to the grails framework, so any help is greatly appreciated.
Upvotes: 1
Views: 307
Reputation: 20699
The line you shown is a part of the following construct:
request.withFormat{
form multipartForm{
flash.message = '' // some message
redirect some
}
'*'{ respond some, [ status:OK ] }
}
and is used to respond to REST-calls and has nothing to do with GSPs. If you want to adjust the GSP rendering, you have to modify the other lines:
request.withFormat{
form multipartForm{
flash.message = '' // some message
redirect action:'myView', id:some.id
// or
render view:'myView', model:[ some:some ]
}
'*'{ respond some, [ status:OK ] }
}
Upvotes: 1