How to pass integer value from a checkbox on JSP to the server?
None of the following 3 checkboxes will pass an integer to the server.
The server receive “k” or “$k” but not 1, 2, 3, …
<td><input type=“checkbox” name=“choice” value=“k”>Data</td>
<td><input type=“checkbox” name=“choice” value=“$k”>Data</td>
<td><input type=“checkbox” name=“choice” value=k>Data</td>
The JSP page is:
<c:set var=“k” value=“0”/>
<c:forEach items=“${model.data}” var=“data”>
<tr>
<c:forEach items=“${data}” var=“datavalue”>
<td style=“font-family:monospace”>${datavalue}</td>
</c:forEach>
<td><input type=“checkbox” name=“choice” value=“k”>Data</td>
<c:set var=“k” value=“$(k+1)”/>
</tr>
</c:forEach>