title: how to get the array values in jsp
body: <p>When I execute this only the last value in array returned as output when I use <code>request.getParameter("quantity")</code> in my JSP file. How can I pass the entire array with all of its values to the JSP file?</p>
  
  <p><strong>myfile1.js:</strong></p>
  
  <pre><code>function savetheChanges()
  {
      for(var i=0;i&lt;16;i++)
      {
          quants[i]=document.getElementById("quantity"+i).value;
          kot1[i]=document.getElementById("kot"+i).value;
          itemcode1[i]=document.getElementById("itemcode"+i).value;
          var billno=document.getElementById("billno").value; 
          document.detailsview.action ="BillCB.jsp?method=" + "17" + "&amp;billno=" +billno+ "&amp;itemcode=" +itemcode[i]+ "&amp;kot=" +kot1[i]+ "&amp;quantity="+quants[i];
       }
  }
  </code></pre>
  
  <p><strong>myfile2.jsp:</strong></p>
  
  <p>(While getting the values I get only the first two elements of array)</p>
  
  <pre><code>billdetails_be.billno = Integer.valueOf(request.getParameter("billno"));
  String[] quantCB = request.getParameterValues("quantity");
  String[] kotCB = request.getParameterValues("kot");
  String[] itemCB = request.getParameterValues("itemcode");
  int[] quantarr = new int[quantCB.length];
  int[] kotarr = new int[kotCB.length];
  int[] itemarr = new int[itemCB.length];
  System.out.println("beforeloop " + itemarr.length);
  for (int i = 1; i &lt; quantarr.length; i++) {
    quantarr[i] = Integer.parseInt(quantCB[i]);
  }
  for (int i = 1; i &lt; kotarr.length; i++) {
    kotarr[i] = Integer.parseInt(kotCB[i]);
  }
  for (int i = 1; i &lt; itemarr.length; i++) {
    itemarr[i] = Integer.parseInt(itemCB[i]);
  }
  for (int i = 1; i &lt; itemarr.length; i++) {
    int quantint = quantarr[i];
    int kotint = kotarr[i];
    int itemint = itemarr[i];
    System.out.println("value in array:" + (quantarr[i]));
  }
  </code></pre>