I have created a new action called "updateWithHistory" on a controller "X" similar to update. When I use this code from a scaffolded edit.gsp page:
<span class="button"><g:actionSubmit class="save" action="updateWithHistory" value="${message(code: 'default.button.updateWithHistory.label', default: 'Persist')}" /></span>
I get a 404 error:
The requested resource (/GPECAN/WEB-INF/grails-app/views/X/updateWithHistory.jsp) is not available.
I don't know why Grails is looking for the view and not for the action. I don't need a view for that action because it redirects to existing actions (list, edit, etc.).
This does not happen with the default scaffolded actions like "update". Any ideas?
(Of course, if I create a view called "updateWithHistory.gsp", the view is shown, but the action is never executed...I'm desperate)
There are two ways to solve your problem, depending what you want to achieve. First thing that you have to know is quote from documentation:
Also note that this tag relies on the multipart resolver to be able to inspect parameters included with mulitpart requests. If you disable the resolver by setting grails.disableCommonsMultipart to true in Config.groovy, actionSubmit will not work.
So two solutions:
PS If you want to see any 'renderable' result by browser you have to use controller's dynamic render method :)
OK, I'm just stupid. It was an uncatched error in my controller; the error situation was ocurring but there was not specific view to handle it, so the controller tried to redirect to an unexisting default view.
Sorry a lot for my stupidity and thanks for your help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.