When I clicked on submit button, I have the following error :
Error: Page Not Found (404)
Path: /QCM/qcm
and in the console log, the following warning appeared :
WARN --- [nio-8080-exec-9] o.s.web.servlet.PageNotFound :
No mapping found for HTTP request with URI [/QCM/qcm] in DispatcherServlet with name 'grailsDispatcherServlet'
Nevertheless, my gsp page is really simple :
<g:form name="qcm" controller="QCM" action="qcm">
<table>
<tr><p>Question</p></tr>
<tr>
<td><g:checkBox name="qcmcheck1" /></td>
<td>Solution 1</td>
</tr>
<tr>
<td><g:checkBox name="qcmcheck2" /></td>
<td>Solution 2</td>
</tr>
<tr>
<td><g:checkBox name="qcmcheck3" /></td>
<td>Solution 3</td>
</tr>
<tr>
<td>
<g:actionSubmit value="Suivant" />
</td>
</tr>
</table>
</g:form>
...
Same things for my controller (QCMController.gsp) :
package openlearning
class QCMController {
def index() {
}
def qcm() {
println("action !");
}
}
I searched on Stackoverflow and the following post help me to find the solution.My problem was not with the return value of the controller's action but with the submit button.
The grails submit button doesn't work ! So if you want to solve this issue, you have to use a simple submit button :
<input type="submit" value="Submit" />
I don't know if it is a bug or a bad use of g:actionSubmit but this workaround helps me.
No comments:
Post a Comment