Next, I have a question about handling a Checkboxes list. I have a list of objects that are the Courses, and I would like this list to be linked to a 'List' of another class as follows:
You are in the JSP
<ul><form:checkboxes element="li" path="aluno.cursos" itemValue="id" itemLabel="nome" items="${cursoList}"></form:checkboxes></ul>
Class to link to
@Document(collection = "alunos")
public class Aluno {
...
private List<Curso> cursos;
...
public List<Curso> getCursos() {
return cursos;
}
public void setCursos(List<Curso> cursos) {
this.cursos = cursos;
}
...
In my controller the function is as follows:
public ModelAndView registered(@ModelAttribute("aluno") Aluno aluno, BindingResult result, HttpServletRequest request) {
System.out.println("Registrando: " + aluno.toString());
...
}
At this point, I see that the list of courses in the student class should be set, but it is NULL
What is the correct way for me to link this list of Checkboxes to my Student class list?