jsp+struts 对搜索出来的结果作删除操作。选中后怎么传到后台action里
下面是搜索结果部分的代码
怎么改
才能把删除值得编号选中
应该改成什么样的选择。。(项目没在myeclipse情况下。)
<%@ page language="java" contentType="text/html; charset=windows-31j" pageEncoding="windows-31j"%>
<%@ taglib uri="/WEB-INF/lib/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/lib/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/lib/struts-tiles.tld" prefix="tiles"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<title>論文カテゴリの検索</title>
</head>
<BODY>
<h1>
論文カテゴリ一覧
</h1>
<div align="center">
<table border="2">
<FORM action="/TestCategory/JSP/delecategory.do" method="post" name="formc">
<tr>
<th>
操作
</th>
<th>
論文カテゴリ番号
</th>
<th>
論文カテゴリ名
</th>
<th>
入力制限
</th>
<th>
最大共著人数
</th>
</tr>
<logic:iterate id="CategoryList" name="list">
<tr>
<td>
<input type="radio" name="radio" value="<bean:write name="CategoryList" property="paper_category"/>"> </td>
<td>
<bean:write name="CategoryList" property="paper_category" />
</td>
<td>
<bean:write name="CategoryList" property="paper_category_name" />
</td>
<td>
<bean:write name="CategoryList" property="rule" />
</td>
<td>
<bean:write name="CategoryList" property="authors_max" />
</td>
</tr>
</logic:iterate>
</table>
<INPUT type="submit" value="削除">
</FORM>
</div>
</body>
</html>
------解决方案--------------------1、
页面单选框改成复选框
<input type="checkbox" name="deleteall" value='<bean:write name="suggestinfo" property="id" />'/>
后台代码
String id[] = request.getParameterValues("deleteall");
String sql = "delete from suggestinfo where id='" + id[0] + "'";
if(id.length > 1)
{
for(int i = 1; i < id.length; i ++)
{
sql += " or id='" + id[i] + "'";
}
}
SuggestInfoBO.delSuggestInfo(sql);
2、如果你使用ActionForm的话复选框也可以用Struts标签,Form中有字符串数组对应就可以取值了
//以前写过的,希望你用的上^_^