JSP form: HttpStatus 400: The request sent by the client was syntactically incorrect
<p>I have this in a jsp:</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form:form method="POST" modelAttribute="answer"&gt;
 &lt;table&gt;
  &lt;tr&gt;
   &lt;td&gt;&lt;label for="chosenanswer"&gt;answer: &lt;/label&gt; &lt;/td&gt;
   &lt;td&gt;
    &lt;form:radiobutton path="chosenAnswer" value="Male" /&gt;Male
    &lt;form:radiobutton path="chosenAnswer" value="Female" /&gt;Female
    &lt;form:radiobutton path="chosenAnswer" value="Other" /&gt;Other 
   &lt;/td&gt;
     &lt;/tr&gt;</code></pre>
</div>
</div>
</p>

<p>When I hit the submit button, I get a HTTPStatus 400 with this message:</p>

<pre><code> The request sent by the client was syntactically incorrect.
</code></pre>

<p>This is what I have in my Controller class:</p>

<pre><code>@RequestMapping(value = { "/take-exam-{examid}" }, method = RequestMethod.GET)
public String takeExam(@PathVariable String examid, ModelMap model) {
    model.addAttribute("answer",new SelectedAnswer());
    model.addAttribute("questiontext","Dummy question text");
    return "exam";
}

/*
 *Answering a question
 */
@RequestMapping(value = { "/take-exam-{examid}" }, method = RequestMethod.POST)
public String answerQuestion(SelectedAnswer answer, BindingResult result,
        ModelMap model, @PathVariable String ssn) {

    model.addAttribute("answer", "SelectedAnswer: "+answer.toString());
    model.addAttribute("success", "SelectedAnswer: "+answer.toString());
    return "success";
}
</code></pre>

<p>My SelectedAnswer class is:</p>

<pre><code>public class SelectedAnswer {
    private String chosenAnswer;

    public String getChosenAnswer() {
        return chosenAnswer;
    }

    public void setChosenAnswer(String chosenAnswer) {
        this.chosenAnswer = chosenAnswer;
    }

    public String toString()
    {
        return "SelectedAnswer = "+chosenAnswer;
    }
}
</code></pre>

<p>The page loads fine, but when I hit the submit button, I get the error with HttpStatus 400:  The request sent by the client was syntactically incorrect.
Any idea what is going on?</p>

<p>Thanks,</p>

<p>Regards,
Serban</p>