title: How to set values of checkboxes generated dynamically
body: <p>Good morning,i have a table inside a form, the table is populated dynamically from an array list and for each row in that table i have a checkbox and its the first column in the table the second column in the table is an id, i want to set the value attribute of the checkbox with the text in the cell behind it(the id column) when that checkbox is checked as i will get all the values from those checkboxes in a servlet using <code>request.getParameterValues</code> when these form is submitted , here's i populate my table :</p>
  
  <pre><code>&lt;form name="Main-Form" action="DeleteServlet" method="GET"&gt;
      &lt;table BORDER=2 BORDERCOLOR=YELLOW width="120px" id="product_table"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;CarId&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Quantity&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Price&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;CC.No&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Engine&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Cylinder.No&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;MaxSpeed&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;PetrolType&lt;/b&gt;&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;PetrolCapacity&lt;/b&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;c:forEach items="${product_list}" var="car"&gt;
              &lt;tr id="data-row"&gt;
                  &lt;td&gt;&lt;INPUT type="checkbox" name="chk" /&gt;&lt;/td&gt; // how to get these checkbox in the for loop
                  &lt;td&gt;&lt;c:out value="${car.carId}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.carDesc}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.quantity}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.price}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.enginCc}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.trans}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.noOfCylinder}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.topSpeed}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.fuelType}" /&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;c:out value="${car.fuelCapacity}" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/c:forEach&gt;
      &lt;/table&gt;
              &lt;td colspan="3"&gt;&lt;input type="submit" class="btn1" value="Delete"/&gt;
  
      &lt;/form&gt;
  </code></pre>
  
  <p>Note: DeleteCar is the servlet that will get the values in the chk_group from the request</p>