title: Getting checkbox value(s) from a Servlet
body: <p>I have a servlet with MySQL database in it. It looks like this: <img src="https://i.stack.imgur.com/Nl3jR.jpg" alt="enter image description here"></p>
  
  <p>here is the piece of code for it: </p>
  
  <pre><code>out.println("&lt;table id = \"main_section\" cellspacing=\"1\" bgcolor=\"red\" &gt; ");
  out.println ("&lt;tr&gt; ");
  out.println("&lt;td &gt;NUMBER&lt;/td&gt;");
  out.println("&lt;td &gt;PAYMENT&lt;/td&gt;");
  out.println("&lt;td &gt;RECEIVER&lt;/td&gt;");
  out.println("&lt;td &gt;VALUE &lt;/td&gt;");
  out.println("&lt;td &gt;CHECKBOX&lt;/td&gt;");
  out.println("&lt;/tr&gt;");
  out.println("&lt;tr&gt;");
  for (int i = 0; i &lt; ex.getExpenses().size(); i++) {
      out.println("&lt;td &gt; " + ex.getExpenses().get(i) + "&lt;/td&gt;");
  
      if (i&gt;0 &amp;&amp; (i+1)%4==0) {
          out.println("&lt;td&gt;&lt;input type=\"checkbox\" name=\"checkbox\"&gt;&lt;/td&gt;");
          out.println("&lt;/tr&gt;&lt;tr&gt;");
  
      }     
  }
  out.println("&lt;/tr&gt;");
  </code></pre>
  
  <p>What I need to do is to create a submit button that calculates the sum of VALUE of the checked boxes. for instance, if NUMBER 1 and 2 are checked the submit button should give the result of 5577.0 (VALUE 22.0+5555.0).
  Can anyone please help me with that?  </p>