日期:2014-05-18 浏览次数:20732 次
public class LoginForm extends ActionForm { private String[] hobby; public String[] getHobby() { return hobby; } public void setHobby(String[] hobby) { this.hobby = hobby; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { return null; } public void reset(ActionMapping mapping, HttpServletRequest request) { } }
------解决方案--------------------
<form>
<input type="checkbox" name="ch1">
<input type="checkbox" name="ch1">
.....
</form>
actionForm 里对应的属性用数组就可以:
String[] ch1 = null;
------解决方案--------------------
把得到的 checkbox 的 id 编号连成一个字符串,以“;”或者 “,” 分隔开,传入 action 时使用
document.location.href=" <%=request.getContextPath()%>/xinao/driverManager.do?method=driverGrouping&setGroupList="+存有id字符床的编号;
后台取:
String []id= request.getParameter(字符串名称).split(";");
循环读取 id 数组就 ok ,这是最通常的做法!