title: How to post an array of hidden fields to a servlet?
body: <pre><code>&lt;form&gt;
  &lt;c:forEach var="cartitems" items="${cart.items}"&gt;
  &lt;input type="hidden" name="productid[]" value="${cartitems.products.productsId}"&gt;
  &lt;/c:forEach&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Above code will generates HTML code like </p>
  
  <pre><code>&lt;input type="hidden" value="1" name="productid[]"&gt;
  &lt;input type="hidden" value="5" name="productid[]"&gt;
  </code></pre>
  
  <p>How do I access these values in servlet, somthing which I have tried but it does not works:</p>
  
  <pre><code>  String[] productsids = request.getParameterValues("productid");
  for(String eachpro  : productsids){
    out.println("Product values : "+eachpro);
  }
  </code></pre>
  
  <p>Is there any other way to do this work</p>