我创建了一张桌子。其中的值将从数据库中动态创建。我在最后一列添加了一个复选框。Now what I like to know is that, when the checkbox is selected that particular row alone want to be stored in new database, so according to how much checkbox is selected that much row should be added in the database. 谁能帮我这个?
提前致谢...
我的代码:
<%@ page import="java.sql.*" %>
<%
String connectionURL = "";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
int f=0;
%>
<html>
<head>
<title>csepoff</title>
</head>
<body>
<form name="cse" action="csepoffcheck1.jsp">
<%
Class.forName("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection(connectionURL,"root","tajmahalss");
statement = connection.createStatement();
String[] batchcse=request.getParameterValues("batchcse");
String batchhcse="";
String data="";
String data1="";
String data2="";
for(int i=0; i<batchcse.length; i++) {
batchhcse+=batchcse[i]+" ";
}
rs=statement.executeQuery("select * from signup where batch='"+batchhcse+"'");
out.println("<table border='1'><tr>");
out.println("<th>NAME</th><th>DEPARTMENT</th><th>BATCH</th>");
out.println("<th>FATHER NAME</th><th>MOTHER NAME</th><th>SELECT</th>");
while(rs.next()){
out.println("<tr>");
out.println("<td>"+rs.getString("name")+"</td>");
out.println("<td>"+rs.getString("depart")+"</td>");
out.println("<td>"+rs.getString("batch")+"</td>");
out.println("<td>"+rs.getString("fname")+"</td>");
out.println("<td>"+rs.getString("mname")+"</td>");
out.println("<td><input type=\"checkbox\" name=\"checkbox\" value=\"${}\"></td>");
out.println("</tr>");
}
out.println("</table>");
%>
<input type="submit" value="SUBMIT">
</form>
</body>
</html>