title: checkbox index value in java
body: <p>I am working in spring mvc, I used the following line to generate the checkboxes from DB table.</p>
  
  <pre><code>&lt;td&gt;&lt;input type="checkbox" name="loanId" value="${loan.id}" class="it"&gt;&lt;/td&gt;
  </code></pre>
  
  <p>I need to get the index of this selected values in my java controller. I am able to get the values which are selected, but how to get the index values?
  <img src="https://i.stack.imgur.com/7Rvoj.png" alt="enter image description here">
  following code is I am using </p>
  
  <pre><code>        String[] loanIds = request.getParameterValues("loanId");
  
          for (String string : loanIds) {
              System.out.println("loanIds****"+string);
          }           
  </code></pre>