Pages

Showing posts with label openlearning_project. Show all posts
Showing posts with label openlearning_project. Show all posts

Tuesday, September 12, 2017

Grails form : No mapping found for HTTP request with URI

Lately, I have a problem with a simple form.
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.


Thursday, September 7, 2017

Uml class Diagram for exam

I started thinking about exam class diagram for my OpenLearning project.
In this project, we need to manage different kinds of Exam.So, what is the best way to design exam class ?

To now I think the design pattern factory is best solution.In the following UML class diagram, we define an abstract class with a createExam() method and we let subclasses to decide about creation.

For example, QcmExamFactory has the responsability to create the correct qcm exam.

There is lot QCM and real exams rules, so it is highly probable that implementation change.Moreover, in this time, there is only three types of exam : test, practice and real.
But I can imagine, it will exist other.That's why, I think the design pattern factory is a good solution.If you aren't agree with me, let me know !







Note : I use draw.io to make this UML picture.

PlayConsole : suppression des warnings lors de la publication (minify, symbole de debogage...)

Lors de la publication des versions dans la PlayConsole, j'avais 2 warnings pour indiquer qu'il était possible de réduire et d'o...