title: how get and pass values in servlet in java?
body: <p>I have Java code like this,
  package my.ebill.pro.db;</p>
  
  <pre><code>import java.io.IOException;
  import java.io.PrintWriter;
  import java.sql.ResultSet;
  import java.text.DateFormat;
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Calendar;
  import java.util.Date;
  import java.util.List;
  import newt.com.properties.*;
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  import java.text.ParseException;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  import java.util.ListIterator;
  
  
  @WebServlet("/BG_Form")
  public class BG_Form extends MyDbConn {
  
      /**
       * 
       */
      private static final long serialVersionUID = -2319984741700546377L;
      static Statement st,st1;
  
      public BG_Form() throws Exception {
          super();
          st=con.createStatement();
          st1=con.createStatement();
      }
  
      @Override
      protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
  
      response.setContentType("text/html;charset=UTF-8");
      PrintWriter out = response.getWriter();
  
  
      String poNumberBas=request.getParameter("poNo");
      String fromPoBas=request.getParameter("toAddress");
      String toPoBas=request.getParameter("toWhomname");
      String[] productsBas = request.getParameterValues("product");
      String[] pricesBas= request.getParameterValues("price");
      String[] qtysBas= request.getParameterValues("qty");
      String[] linetotalsBas = request.getParameterValues("linetotal");
           System.out.println("Product"+productsBas);
      /*out.println( poNumber + fromPo+toPo+products+prices+qtys+linetotals+"Adress");*/
      PoGet poget=new PoGet();
      poget.setFromPo(fromPoBas);
      poget.setToPo(toPoBas);
      poget.setProducts(productsBas);
      poget.setPrices(pricesBas);
      poget.setPoNumber(poNumberBas);
      poget.setQtys(qtysBas);
      poget.setLinetotals(linetotalsBas);
  
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p>here getter and setter;</p>
  </blockquote>
  
  <pre><code>public class PoGet {
  
      private String poNumber;
      private String fromPo;
      private String toPo;
      private String[] products;
      private String[] prices;
      private String[] qtys;
      private String[] linetotals;
  }
  </code></pre>
  
  <p>and jsp code is</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;%@include file="includes/headscript.jsp" %&gt; 
   &lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="validationform" name="validationform" method="get" action="BG_Form"&gt;
  &lt;input type="text" style="border-right-width: 2px; margin-right: 0px; margin-left: 33px; margin-top: -15px;" id="F_Date" class="dateRagePicker leftPick1 hasDatepicker" maxlength="20" size="20"&gt;
  &lt;table class="order-list" style="margin-left: 228px;"&gt;
      &lt;thead&gt;
          &lt;tr&gt;&lt;td&gt;Product&lt;/td&gt;&lt;td&gt;Price&lt;/td&gt;&lt;td&gt;Qty&lt;/td&gt;&lt;td&gt;Total&lt;/td&gt;&lt;/tr&gt;
      &lt;/thead&gt;
  
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;input type="text" name="product"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" name="price"&gt;
              &lt;/td&gt;&lt;td&gt;&lt;input type="text" name="qty"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input type="text" readonly="readonly" name="linetotal"&gt;&lt;/td&gt;
              &lt;td&gt;&lt;a class="deleteRow"&gt; x &lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  
      &lt;tfoot&gt;
          &lt;tr&gt;
              &lt;td style="text-align: center;" colspan="5"&gt;
                  &lt;input type="button" value="Add Product" name="addrow" id="addrow"&gt;
  
              &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td colspan="5"&gt;
                  Grand Total: Rs&lt;span id="grandtotal"&gt;&lt;/span&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td&gt;
          In Words &lt;span id="inworDs" &gt;&lt;/span&gt;
  
          &lt;/tr&gt;
          &lt;tr&gt;
                  &lt;td&gt;
                  &lt;input type="submit"/&gt;
  
          &lt;/tr&gt;
      &lt;/tfoot&gt;
  &lt;/table&gt;
  
  &lt;/form&gt;
  
  
  
  &lt;script&gt;
      $("#addrow").click(function(){
        var newRow = $("&lt;tr&gt;");
                var cols = "";
                cols += '&lt;td&gt;&lt;input type="text" name="product"/&gt;&lt;/td&gt;';
                cols += '&lt;td&gt;&lt;input type="text" name="price"/&gt;&lt;/td&gt;';
                cols += '&lt;td&gt;&lt;input type="text" name="qty"/&gt;&lt;/td&gt;';
                cols += '&lt;td&gt;&lt;input type="text" name="linetotal" readonly="readonly"/&gt;&lt;/td&gt;';
                cols += '&lt;td&gt;&lt;a class="deleteRow"&gt; x &lt;/a&gt;&lt;/td&gt;';
                newRow.append(cols);
          $("table.order-list").append(newRow);
      });
      $("table.order-list").on("change", 'input[name^="price"], input[name^="qty"]', function (event) {
          calculateRow($(this).closest("tr"));
          calculateGrandTotal();
      });
  
      $("table.order-list").on("click", "a.deleteRow", function (event) {
          $(this).closest("tr").remove();
          calculateGrandTotal();
      });
  
  
  function calculateRow(row) {
      var price = +row.find('input[name^="price"]').val();
      var qty = +row.find('input[name^="qty"]').val();
      row.find('input[name^="linetotal"]').val((price * qty).toFixed(2));
  }
  
  
  function calculateGrandTotal(f) {
      var grandTotal = 0;
      $("table.order-list").find('input[name^="linetotal"]').each(function () {
          grandTotal += +$(this).val();
              });
      $("#grandtotal").text(grandTotal.toFixed(2));
  
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>from jsp i am getting the multiple values String array,</p>
  
  <p>can any one tell me how can i retrive and set the values which i am sending from javascript.</p>
  
  <p>i need to get values has to pass it to database.</p>