I have a multiple select something like this..
<select multiple="multiple" th:field="*{names}">
<option value="abc">abc</option>
<option value="def">def</option>
<option value="ghi">ghi</option>
<option value="jkl">jkl</option>
</select>
where names
is the name of the list which looks like this..
List<String> names=new ArrayList<>();
Now, I would like the user to select multiple names and then put into the names
list.
Consider that I have selected
abc
def
ghi
When I am submitting the form, I see that the data is sent like this..
names=abc&names=def&names=ghi
however, I want it to be like names[0]=abc&names[1]=def&names[2]=ghi
.
P.S. I don't want to use Ajax form sending.