<form id=Formaaa action ="" method=Post>
<tr>
<td id=aaa><input id=dddinput></td>
<td id=bbb><input id=dddinput></td>
<td id=ccc><input id=dddinput></td>
<td id=ddd><input id=dddinput></td>
</tr>
<input type=button value=submitForm(Formaaa)>
</form>
function submitForm(thisForm){
var aaa=document.Formaaa.aaainput.value;
........
}
<tr>
<td id=aaa><input id=dddinput></td>
<td id=bbb><input id=dddinput></td>
<td id=ccc><input id=dddinput></td>
<td id=ddd><input id=dddinput></td>
</tr>
<input type=button value=submitForm(Formaaa)>
</form>
function submitForm(thisForm){
var aaa=document.Formaaa.aaainput.value;
........
}
<table>
<tr>
<td><input name="id_1"></td>
<td><input name="id_2"></td>
<td><input name="id_3"></td>
<td><input name="id_4"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
……
</table>
</form>在“处理提交数据的JSP或servlet”中用request.getParameter("id_1"),
request.getParameter("id_2");……,获得表格中的数据,
然后构造SQL语句,执行数据库的插入操作即可。
<table border=1>
<form id=Formaaa action ="" method=Post>
<tr>
<td><input name="a"></td>
<td ><input name="b"></td>
<td ><input name="c"></td>
<td><input name="d"></td>
<td><input type=submit value="提交"></td>
</tr>
</form>
<form id=Formaaa action ="" method=Post>
<tr>
<td><input name="a"></td>
<td ><input name="b"></td>
<td ><input name="c"></td>
<td><input name="d"></td>
<td><input type=submit value="提交"></td>
</tr>
</form>
</table>
ClassName obj=null;
obj.setName("张三");
<%
index=0;
while(循环所有的新生)
{
%>
<tr>
<td><input name="line<%=index%>_bh"></td>
<td><input name="line<%=index%>_xm"></td>
<td><input name="line<%=index%>_xb"></td>
<td><select name="line<%=index%>_bj"></td>
</tr>
<%
index++;
}
%>
//然后记住最大的index,如下:
<input type="hidden" value=<%=index%> name="maxindex">
//在提交表单的处理时,这样获得一行的数据:
for(int i=0;i<=index;i++){
String bh=request.getParameter("line"+i+"_bh");
String xm=request.getParameter("line"+i+"_xm");
String xb=request.getParameter("line"+i+"_xb");
String bj=request.getParameter("line"+i+"_bj");
//存储到数据库。
}