<td>
<table id="pointtable" a>
<tr>
<td >
<%
for(int l=0;l<buss_list.size();l++)
{
HashMap mohm = (HashMap)buss_list.get(l);
%>
<input type="checkbox" id="<%=mohm.get("ID") %>" value="<%=mohm.get("ID") >" name="moid"/>
<%=mohm.get("BNAME") %>
<%
}
%>
</td>
</tr>
</table>
</td>
RT 遍历出很多chexkbox 怎么样这些checkbox 5个自动换行!谢谢!
解决方案 »
- jenkins中如何自动地定期去构建一个web项目?
- FusionChart导出图形到excel中
- 关于Servlet运行过程的问题~!
- 关于“输入网络密码”的实现
- 数据量大生成树的问题
- 高分求助:网站的概要设计说明书和详细设计说明书!
- Mysql中文问题?jsp+myql+linux+tomcat--->寻求高手^_^
- 求一个JSP自定义标签库的简单例子。在线等。
- JSP与MYSQL网站出现的情况
- javaweb部署到liunx的tomcat下运行报错
- Duplicate class/entity mapping pfc.str.Userinfo
- MyEclipse部署FineReport报表软件
否则就判断索引,大于5出br
<table id="pointtable" a>
<tr>
<td>
<%
String chkBoxFmt = "<input type='checkbox' id='%s' value='%s' name='moid'/>%s ";
for (int l = 0; l < buss_list.size(); l++) {
HashMap mohm = (HashMap) buss_list.get(l);
String id = mohm.get("ID") + "";
String bname = mohm.get("BNAME") + "";
out.print(String.format(chkBoxFmt, id, id, bname));
//每5个换行
if (l % 5 == 0)
out.print("<br/>");
}
%>
</td>
</tr>
</table>
</td>
out.print("<br/>");
}
<td>
<table id="pointtable">
<%
boolean isEnd = false;
int f = 1;
for(int l=0;l<buss_list.size();l++)
{ isEnd = false;
HashMap mohm = (HashMap)buss_list.get(l);
if(l % 5 == 0 && f % 2 == 1) {
%>
<tr>
<%
} else if(f % 2 == 1) {
f++;
}
%>
<td><input type="checkbox" id="<%=mohm.get("ID") %>" value="<%=mohm.get("ID") >" name="moid"/><%=mohm.get("BNAME") %></td>
<%
if(l % 5 == 4 && f % 2 == 0) {
%>
</tr>
<%
isEnd = true;
f++;
}
}
if(!isEnd) {
%>
</tr>
<%
}
%>
</table>
</td>代码没有测试,只是随便写了个思路,可以把任意个数的checkbox以每行5个的形式列在表格里,楼主请享用!