struts中如何在后台控制器实现前台的带有checkbox的删除操作,下面代码中省略号部分该如何操作?

AgreementAction.javapublicActionForwarddoDeleteAll(ActionMappingmapping,ActionFormfor... AgreementAction.java
public ActionForward doDeleteAll(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// 获取请求参数
……
// 参数校验后业务处理
……
// 返回列表页面
try {
response.sendRedirect("/SNTAXAPP/agreement.do?op=toShowAgreementList");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}

agreementList.jsp:
<html:form action="/agreement.do?op=toShowAgreementList" method="post">
<table width="98%" align="center" class="border" id="mytable" border="1" style="padding: 0px">
<thead>
<tr>
<th><input type="checkbox" onclick="clickme(this)"/></th>
<th>序号</th>
<th>申请单号</th>
<th>协议编号</th>
<th>商品总类名称</th>
<th>供应商名称</th>
<th>供应商税号</th>
<th>数量</th>
<th>金额</th>
<th>税额</th>
<th>类型</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<c:forEach var="item" items="${agreementForm.pageBean.dataList}">
<tr>
<td><input type="checkbox" value="${item.agreementNo }" name="agreementNo"/></td>
<td>${item.id }</td>
<td>${item.number }</td>
<td>${item.agreementNo }</td>
<td>${item.goodsName }</td>
<td>${item.sellNameFormat }</td>
<td>${item.sellTaxNo }</td>
<td>${item.amount }</td>
<td>${item.total }</td>
<td>${item.tax }</td>
<td>${item.type }</td>
<td>
<html:link action="/agreement.do?op=toShowAgreementDetail&agreementNo=${item.agreementNo}" target="_bank">详细</html:link>
|
<html:link action="/agreement.do?op=doDelete&id=${item.id}" onclick="return isDel()">删除</html:link>
</td>
</tr>
</c:forEach>
<tr>
<td colspan="12">
<kevin:page formName="agreementForm" />
</td>
</tr>
</tbody>
</table>
</html:form>
展开
 我来答
david5901211
2011-04-01 · 超过38用户采纳过TA的回答
知道小有建树答主
回答量:210
采纳率:0%
帮助的人:79.6万
展开全部
用Form里面定义一个集合接受checkbox得参数。,然后根据集合删除
for(...;...;...;){
delete(id);
}
更多追问追答
追问
AgreementForm agreementForm = (AgreementForm) form;
这个form怎么来接收?能再详细点吗?谢谢!!!
追答
比如说再jsp页面中有checkbox得名字是check 你就再actionform中定义一个check[]来接收,
然后只要再 ,
for(int i=0;i< agreementForm .check.length;i++s){
//根据你接收到得值来删除 delete(agreementForm .check[i]);
}
lizhen860316
2011-04-01 · 超过26用户采纳过TA的回答
知道答主
回答量:118
采纳率:0%
帮助的人:88.9万
展开全部
在后台接受那个checkbox的值 遍历出每一个来 delete(id)
追问
checkbox的值该如何接收?
追答
request.setAtribute(checkbox-name)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式