Handling multiple <input> s with the same name in spring -mvc

Please take a look at the codes below. Four text fields are displayed.

If I enter “1” and “2” in the previous text fields, they are anchored as comma-separated “1,2”, as I expected.

However, if I insert “2001/01/01” and “2001/01/02” into the rest of the two drawers, “2001/01/01” is tied. "2001/01/01" is inspired only surprisingly. The first parameter takes precedence for binding.

I want to know where the specifications are defined (HTTP or SpringMVC or ...?) About this in order to understand deeply and accurately. Can anybody help me?

Form
public class SampleForm {

    private String name;

    private Date date;

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

JSP
<form:form modelAttribute="form" method="post">
    <form:input path="name" />
    <form:input path="name" />
    <form:input path="date" />
    <form:input path="date" />
    <p>
        <input type="submit" name="register" value="register" />
    </p>
</form:form>
+5
source share
2

. String . Date Date.

String[] Date[].

+5
private List<Date> date= new ArrayList<Date>();

    public List<Date> getDate() {
        return date;
    }
    public void setDate(List<Date> date) {
        this.date= date;
    }

.

+2

All Articles