您的位置:首页 > 其它

页面上用c标签循环输出结果集时,怎么按一定数量和整齐的格式排序

2013-01-03 21:58 295 查看
  当我们查询出数据时,要在页面上输出,而且是用的<c:forEach></c:forEach>循环的,那么可以在标签里面设一个属性varStatu,这样就可以得到很整齐的格式了,而且还是按一定数量排列的。。如下:

        <table>

          <tr>

            <c:forEach items="${types}" var="type" varStatus="loop">

               <td>

                   <c:if test="${fn:length(type.childtypes)>0}">

                                <a href='<html:rewrite action="/control/product/manage" />?method=selectUI&typeid=${type.typeid}'>${type.name}</a>

                  </c:if>

                 <c:if test="${fn:length(type.childtypes)==0}">

                          <input type="radio" name="type" onclick="javascript:getDicName('${type.typeid}','${type.name}')">${type.name}

                </c:if>

          </td>

         <c:if test="${loop.count%5==0}"></tr><tr></c:if>

        </c:forEach>

     </tr> 

   </table>

这里是按每一行5个数据排列的,所以是loop.count%5==0,后面就是</tr>换行了。

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐