xiaochong / zkui

Grails ZK UI Plugin
http://grails.org/plugin/zkui
GNU Lesser General Public License v3.0
24 stars 8 forks source link

redirect from controller causes 'server is temporaryily out of service' #55

Closed woodmawa closed 12 years ago

woodmawa commented 12 years ago

in this madness of trying to hand craft an MVVM equiv for the MVC generated code i get an error when trying to do a redirect

on my createMVVM gsp i have a button like this, having filled in sample data fields

...

/z:columns ``` ``` in the view model i have an action like so which does the redirect back to the listMVVM gsp ``` @Command ('create') // triggered by binder ``` // def createNewInstance(@BindingParam ("newBook") Book newBook) { def createNewInstance () { println "create new instance called on ${this}, with new book " + selectedBook //+ " and passed " + newBook ``` def bookInstance = selectedBook //binder writes attributes into selectedBook if (!bookInstance.save(flush: true) && bookInstance.hasErrors()) { log.error bookInstance.errors //self.renderErrors(bean: bookInstance) how to do this in view? } else { flash.message = g.message(code: 'default.created.message', args: [g.message(code: 'book.label', default: 'Book'), bookInstance.id]) redirect(controller: "BookMVVM", action: "listMVVM") } } ``` when the code hits the redirect the browser throws an error (firefox) "the server is temporarily out of service would you like to try again (syntax error (syntex error))" however the console log shows that the listMVVM action has been called, and read the new saved book - and the @Init has been called - but the browser just shows the error and doesnt move - if you hit ok - it gives you user access back but stays in the create gsp form (even though the console says its moved on) - if you then hit the 'book list' button - it launches the listMVVM as normal and your back to the listing console log book controller com.softwood.BookMVVMController@145fde (listMVVM) starting view ran init on com.softwood.BookMVVMController@18c29b5 to set bookList[book (title:war of worlds , ISBN:abc-123), book (title:my book, ISBN:xyz-123), book (title:do that thing, ISBN:mnp-123), book (title:magna cartner, ISBN:def-123)]and built selectedBook book (title:, ISBN:) for book controller why doesnt that redirect from command action work ? how should you jump to another page from an MVVM command action ?
UmaSathya commented 10 years ago

Hi

I'm facing the same issue, if the issue is resolved, could you please post the solutuon