Springmvc form tags about attribute association

there is an one-to-many association in the model object
used on the page:

<form:form action="" commandName="form" method="post">

how do I set up one-to-many associated objects?
for example, there are classes:

public class  ClassObj
    private String name;
    private Set<Student> students;
    /** getter setter **/

Student category:

public class  Student
    private String name;
    /** getter setter **/

how do you write the < form:form > tag of that page so that you can set up one-to-many associated objects in a form?

Apr.08,2021

you can use spring's WebDataBinder
server

@InitBinder("classObj")
public void initUser(WebDataBinder binder){
    // 
    binder.setFieldDefaultPrefix("classObj.");
}
@InitBinder("student")
public void initAdmin(WebDataBinder binder){
    binder.setFieldDefaultPrefix("student.");
}

@RequestMapping(value = "xxx")
@ResponseBody
public String xxx(ClassObj classObj, Student student){
    // do something    
}

within the form form:

<input name='classObj.name' />
<input name='student.name' />
Menu