html:checkbox标签使用?
<logic:iterate id= "user " name= "user ">
<tr>
<td>
<html:checkbox name= "user " property= "send " > </html:checkbox>
<bean:write name= "user " property= "id " />
</td>
<td>
<bean:write name= "user " property= "groupdeptno " />
</td>
<td>
<bean:write name= "user " property= "groupname " />
</td>
<td>
<bean:write name= "user " property= "userno " />
</td>
<td>
<bean:write name= "user " property= "realname " />
</td>
</tr>
</logic:iterate>
===查看源文件如下:
<tr>
<td>
<input type= "checkbox " name= "send " value= "on ">
1
</td>
<td>
1
</td>
<td>
局领导
</td>
<td>
admin
</td>
<td>
陈安明
</td>
</tr>
<tr>
<td>
<input type= "checkbox " name= "send " value= "on ">
2
</td>
<td>
2
</td>
<td>
所领导
</td>
<td>
陈安明
</td>
<td>
上陈
</td>
</tr>
<tr>
<td>
<input type= "checkbox " name= "send " value= "on " checked= "checked ">
3
</td>
<td>
2
</td>
<td>
所领导
</td>
<td>
003
</td>
<td>
003
</td>
</tr>
===
现在checkbox是否选择,已可以根据数据库字段中send值来的,send=1是选择,相反不选择.但问题是checkbox 的 name都等于 "send "了,我现在想要的是,当我改变每条记录是否选择的值,并要保存到数据库中,我该怎样拿到每一个checkbox中的值?
------解决方案--------------------不能够这样显示,你看是否可以这样
<bean:write name= "user " property= "groupname " value= <%=用户id%> /> .
------解决方案--------------------使用一下语句先获得所有的send值,然后循环获得各个的send值
Sting[] sends = request.getParameterValues()
------解决方案--------------------得到所有的,减去选种的
------解决方案--------------------不用放入SESSION,直接放入form中.然后画面就可以取得到了.