开发者

How to pass data from selected rows using checkboxes from JSP to the server

开发者 https://www.devze.com 2023-01-31 20:24 出处:网络
I\'d like to know if there\'s any way to send data to the server for the selected rows using the checkboxesI\'ve put on those rows?I mean , how can I send only the data of those selected rows to the s

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?

How to pass data from selected rows using checkboxes from JSP to the server

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&g开发者_如何学Pythont;
     </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.


When handling the request use request.getParameterValues("selectedItems"). And I don't think it's needed to add [] to names

0

精彩评论

暂无评论...
验证码 换一张
取 消