How to pass checkbox array to Java from jsp

Posted by eddy on Stack Overflow See other posts from Stack Overflow or by eddy
Published on 2010-12-23T23:11:17Z Indexed on 2010/12/24 0:54 UTC
Read the original article Hit count: 225

Filed under:
|
|

Hi, I'd like to know if there's any way to send data to the server for the selected rows using the checkboxes I've put on those rows? I mean , how can I send only the data of those selected rows to the server?

alt text

Here's the html code I use:

<table>
  <thead>
    <tr class="tableheader">
      <td width="10%"></td>
      <td width="30%">Vehicle</td>
      <td width="40%">Driver</td>
      <td width="10%">Mileage</td>
     </tr>
  </thead>
  <tbody>
    <c:forEach items="${list}" var="item">
         <tr>
             <td align="center">
                <input type="checkbox" name="selectedItems" 
                    value="c:out value="${item.numberPlate}"/>"/>
             </td>
             <td align="left"><c:out value="${item.numberPlate}"/></td>
             <td align="left"><c:out value="${item.driver.fullName}" /></td>
             <td align="left"><input type="text" name="mileage" value="" /></td>
          </tr>
     </c:forEach>                       
   </tbody>
</table>

I really hope you can give some guidance on this.

Thanks in beforehand.

© Stack Overflow or respective owner

Related posts about java

Related posts about html