I have defined row and column using jsp form:checkbox as shown in the code below. I am using List to capture the entry. The problem with using form:checkbox is that it is not indexed properly. When I use form:input the input index is proper. Is there something I can do to capture index properly? By index I mean that when I put form:input I see the variable "a" has 12 values and unentered value are also shown but with form:checkbox I don't see 12 values and order is random.
Code in controller
private List<String> a;
Code in JSP
<tr>
<th class="text-center">JAN</th>
<th class="text-center">FEB</th>
<th class="text-center">MAR</th>
<th class="text-center">APR</th>
<th class="text-center">MAY</th>
<th class="text-center">JUN</th>
<th class="text-center">JUL</th>
<th class="text-center">AUG</th>
<th class="text-center">SEP</th>
<th class="text-center">OCT</th>
<th class="text-center">NOV</th>
<th class="text-center">DEC</th>
</tr>
<tr>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
<td><form:checkbox path="a" value="Y"/></td>
</tr>
c:foreach). Look at stackoverflow.com/questions/16774850/… for example.