我這有一個程序,不知能不能幫到你!!
<--
這是a1.jsp頁面程序
-->
<jsp:useBean id="pool" scope="page" class="sql_link.sql_link"/>//引用數據庫連接bean
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
<title>Untitled</title>
</head>
<body>
<form name=f1 action="a2.jsp" method="post">
<table>
<%ResultSet rs = null;
int i=0;
rs=pool.Query("select id,姓名,性別 from 數據庫名");
while(rs.next())
{
i++;
String tax="ta"+String.valueOf(i);
String tbx="tb"+String.valueOf(i);
String tcx="tc"+String.valueOf(i);
%>
<tr>
<td>
<input type=hidden name="<%=tcx%>" value="<%rs.getInt(1)%>">
<input type=text name="<%=tax%>" value="<%=rs.getString(2)%>">
</td>
<td>
<input type=text name="<%=tbx%>" value="<%=rs.getString(3)%>">
</td>
</tr>
<%
}
%>
<input type=hidden name=hh value="<%=i%>">
</table>
</form>
</body>
</html>
//------------------------------------------------------------------------------
//a2.jsp接受從a1.jsp頁面傳過來的數據並存入數據庫!!
<jsp:useBean id="pool" scope="page" class="sql_link.sql_link"/>//引用數據庫連接bean
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
<title>Untitled</title>
</head>
<body>
<%
int key=integer.parseInt(request.getParameter("hh"));
for(int i=1;i<=key;i++)