页面中的form如下:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><html:form method="post" action="/roles/add.do">
<table border="0" cellspacing='0' cellpadding='0' width="80%" height="200">
<tr>
<td align="left">
<div style="display:block;overflow-y:scroll;overflow-x:auto;height:280px;">
<c:forEach items="<%=list %>" var="unit">
<html:checkbox property="unitsid" value="${unit.id}">
${unit.name}
</html:checkbox>
<br/>
</c:forEach>
</div>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<html:submit value="提交"/> <html:reset value="取消"/>
</td>
<td>
</tr>
</table>
</html:form>在容器中有对应的Form设置了String unitsid的属性和getter、setter方法,
问题在于form读到的unitsid只有所有checkbox中被选中的第一个的值,其他的并未被传入求struts高手帮忙,怎么把checkbox的数据一起提交给form,然后怎么解析,谢谢!
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %><html:form method="post" action="/roles/add.do">
<table border="0" cellspacing='0' cellpadding='0' width="80%" height="200">
<tr>
<td align="left">
<div style="display:block;overflow-y:scroll;overflow-x:auto;height:280px;">
<c:forEach items="<%=list %>" var="unit">
<html:checkbox property="unitsid" value="${unit.id}">
${unit.name}
</html:checkbox>
<br/>
</c:forEach>
</div>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<html:submit value="提交"/> <html:reset value="取消"/>
</td>
<td>
</tr>
</table>
</html:form>在容器中有对应的Form设置了String unitsid的属性和getter、setter方法,
问题在于form读到的unitsid只有所有checkbox中被选中的第一个的值,其他的并未被传入求struts高手帮忙,怎么把checkbox的数据一起提交给form,然后怎么解析,谢谢!
解决方案 »
- Eclipse IDE for Java EE Developers 如何配置开发环境
- Myeclipse7.0里如何配置FCKeditor
- 寻求JAVA反编译软件和JAVA代码加密软件
- 如何才能获得所谓的工作经验
- 博客的文章是直接存到数据库还是怎么存??知道的帮帮忙,谢谢
- 怎么做容量规划?
- 网站数据库与企业内部各主要应用系统的数据交换你们怎么实现的啊?
- 有人知道jive的源代码再那下载吗???
- Vector vSubInsureType=(Vector)hBaseInfo.get("vSubInsureType");(很简单的)
- 有没有比较了解Tomcat的?
- servlet实现ServletContextListener接口的问题
- hibernate 删除记录问题
<action attribute="unitsForm" name="unitsForm"
path="/units/act" type="org.springframework.web.struts.DelegatingActionProxy"
scope="request" validate="false">
<forward name="done" path="/test.jsp" />
</action>unitsForm中:
private String unitsid;
然后有getter和setter方法action中就是打印unitsid的值,怎么看也只有一个。。