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

后端 未结 3 1953
抹茶落季
抹茶落季 2021-01-07 07:06

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 (i

3条回答
  •  半阙折子戏
    2021-01-07 07:58

    Change the mileage input as follows:

      
          
              
                "/>  
            
              
              
            " value="" />  
          
    
    

    Gather it as follows:

    String[] selectedItems = request.getParameterValues("selectedItems");
    for (String selectedItem : selectedItems) {
        String mileage = request.getParameter("mileage_" + selectedItem);
        // ...
    }
    

    No need for nasty JS workarounds.

提交回复
热议问题