Click to See Complete Forum and Search --> : Pass integer value from a checkbox on JSP to the server


albertkao
02-11-2010, 12:43 PM
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>

ahurtt
02-20-2010, 08:38 PM
try value="${k}"