I need an explanation on the role of BindingResults. Though i have studied it on internet and it seem to be used for validating the request and holding errors but i haven't found answers in details that could explain the situation i experienced.
So below is a field in an Entity
private List<Grade> listOfGrade;
which is populated from a form
Select Grades
<td>
<select id="listOfGrade" name="listOfGrade" multiple="multiple">
<option value="70">6</option><option value="71">7</option><option value="72">8</option><option value="73">9</option><option value="74">9</option>
</select><input type="hidden" name="_listOfGrade" value="1"/>
</td>
</tr>
If i remove the above mentioned "select" from the form, the form gets submitted without bindingResult; but if kept the form does not get submitted without BindingResult option being added to controller method. It gives error 400. Why?
Thanks in Advance! Abhi
The answer for you question regarding the 400 Bad request error is if you remove the select then obviously it will give the 400 error because the
listOfGradefield will not be present.and to validate list please refer below answer.
https://stackoverflow.com/a/34227850/6572971
Hope it helps.