<% int i=1; while(rs.next())  {  %>
<tr> <td> <input type="text" name="size<%=i%>" value=""> </td>
     <td> <input type="text" name="qty<%=i%>" value=""> </td>
</tr> <% i++; %>
<tr> <td> <input type="text" name="size_r<%=i%>" value=""> </td>
     <td> <input type="text" name="qty_r<%=i%>" value=""> </td>
</tr> 
<% i++; } %>
將這個i的值傳給處理頁。
處理頁面代碼為﹕取得i的值為count
<% 
String size="";
String qty="";
for(int i=1;i<count;i++) { 
String s1="size"+i;
String q1="qty"+i;
try {
if(request.getParameter(s1)!=null;
size=request.getParameter(s1);
if(request.getParameter(q1)!=null;
qty=request.getParameter(q1);
}
catch(Exception e) {}
if(qty.length()>0) {
try {
cs = conn.prepareCall("{call sp_insert(?,?)}");  
     cs.setString(1,size);
     cs.setString(2,qty);
}
catch(Exception e) {}
}
}
%>