I want to know how I can insert data bulk at once to MySQL database I don't know how to do it.Insert table data when clicked submit button according to mvc.
farmer id
and name
came from another table I want to add all data into another table, farmer id
and name
are readonly
milkload jsp page
<form action="MilkloadAdd" method="post">
<table id="example" class="display" width="100%" cellspacing="0">
<%
List<Farmer> farmer = (List<Farmer>)
request.getAttribute("Farmer_list");
for (Farmer emp1 : farmer) {
%>
<tr>
<td> <input type="text" name="f_id" value="<%=emp1.getfId()%>" readonly="readonly" required/></td>
<td> <input type="text" name="fname" value="<%=emp1.getfFname()%>" readonly="readonly"required/></td>
<td><input type="text" name="lactometer" value="" required onkeyup="snf();"/></td>
<td><input type="text" name="fatvalue" value="" required onkeyup="snf();"/></td>
<td><input type="text" name="weights" value=""required/> </td>
<td><input type="text" name="snf" value=""required readonly="readonly"/></td>
</tr>
<% } %>
milkload model class
public void setLactometer(String lactometer) {this.lactometer = lactometer;}
public String getFatvalue() {return fatvalue;}
public void setFatvalue(String fatvalue) {this.fatvalue = fatvalue;}
public String getWeights() {return weights;}
public void setWeights(String weights) {this.weights = weights;}
public String getDate() {return date;}
private String date;
private String cpid;
private String milkindex;
private String snf;
}
MilkLoadDAO Class
package com.nestle.db;
public class MilkloadDAO {
private static final String SQL_INSERT_MILKLOAD="INSERT INTO
milk_load(Date,Cp_Id,F_Id,Fat,Weight,Lactormeter) VALUES (?,?,?,?,?,?)";
public static void insertMilkLoad(Milkload milkload) {
}