title: HTML to Servlet to JSP dynamically Table
body: <p>I'm trying to send a table with 3 input text with a value that I write by form POST.</p>
  
  <pre><code>  &lt;form method=POST action="Servlet"&gt;
  
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type=text name=num1 size=10&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type=text name=num2 size=10&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type=text name=num3 size=10&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
      &lt;/table&gt;
  
      &lt;input type=submit&gt;
  
      &lt;/form&gt;
  </code></pre>
  
  <p>Then I recieve the values in servlet like this:</p>
  
  <pre><code>String [] num1 = request.getParameterValues("num1");
  </code></pre>
  
  <p>When I got all the values inside the array, I loop the array, then I add inside an arraylist all the values.</p>
  
  <pre><code>ArrayList&lt;String&gt; List = new ArrayList&lt;String&gt;();
  for(int i= 0; i &lt; num1.length; i++){
      List.add(num1[i]);  
  }
  </code></pre>
  
  <p>Finally I send the values to JSP:</p>
  
  <pre><code>request.setAttribute("num1", List);
  request.getRequestDispatcher("/JSPSite.jsp").forward(request, response);
  </code></pre>
  
  <p>The thing that I dont know how to do is.. If now the table got a button that when I click it increment +1 the column dynamically, How can I send all the input values, to servlet, calculate the sum of them, then In jsp show the same table with a td below the input text with the sum of the inputs?</p>