I've created a grails application for test.
Create a domain class the run zkui-generate-all.
In the grail controller I have:
def index = {
redirect(action: "list", params: params)
}
def list = {}
def create= {
def bookInstance = new Book()
bookInstance.properties = params
return [bookInstance: bookInstance]
}
def edit = {
if (!bookInstance) {
flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'book.label', default: 'Book'),
params.id])}"
redirect(action: "list")
}
else {
return [bookInstance: bookInstance]
}
}
Why still using closures rather than methods?
I've modified, for example the create closure to:
def create() {
respond new Book(params)
}
using the new respond method and it works.