我想使用复选框来更新数据库中的多个值,同时使用单个查询提前java。我正在使用这段代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link href="../../css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<html:form action="viewappnt">
<table align="left" valign="top" width="295" border="0" id="box-table-b" >
<thead><tr align="center">
<th colspan="4" nowrap><bean:message key="viewapp.heading"/></th>
</tr></thead>
<%
regForm reg = (regForm) session.getAttribute("reg");
reg.getspec();
String sql = "Select * from appointment where specs=?";
ArrayList alist = new ArrayList();
alist.add(reg.getSpecs());
ResultSet rs = SQLC.getData(sql, alist);
int t = 0;
while (rs.next()) {
String userid = rs.getString("userid");
String appdate = rs.getString("appdate");
String apptime = rs.getString("apptime");
%>
<td nowrap ><html:text property="appuserid" value="<%=userid%>" size="3" readonly="true" styleId="htmltext"/></td>
<td width="106"><html:text property="appdate" value="<%=appdate%>" size="5"/></td><td width="80">
<html:text property="apptime" value="<%=apptime%>" size="5"/></td>
<td><html:checkbox property="apppat" value="<%=userid%>"></html:checkbox></td>
</tr>
<%
t = t++;
}
%>
<tr>
<td colspan="4" align="center" valign="middle" nowrap><html:submit property="method"><bean:message key="UserForm.apppat"/></html:submit></td>
</tr>
</table>
</html:form>
我不知道如何通过这个对多个值使用更新命令。