在jsp中怎么实现 数据库读出来的记录在页面上分两列显示 如
1 忍忍忍     2 让让让
3 太太太     4 我我我
5 数数数     6 出出出
7 记记记     8 页页页
        上页  下页asp上 有个next 用个循环就可以了 java的logic:iterate 怎么弄呢~~~
高手们指点下哦

解决方案 »

  1.   

    logic:iterate   一次读两条记录
      

  2.   

    可以参考下,用的是C标签
    <table width="100%" >
                      <tr>
                        <td colspan="4"></td>
                 <c:forEach var="item" items="${query_list}" varStatus="status">
        <c:if test="${status.index%2==0}">
            </tr>
    <tr id="tr_terminal${status.index/2}" class="biao-bg" style="display:">
        </c:if>
        <td width="25%" style="font-size:11px;display:;"  valign="top" >
    <DIV title="${item.param_code}" STYLE="width: 160px; overflow: hidden; text-overflow:ellipsis">
                           <NOBR>
                           <c:if test="${rssForm.rssInfo.cbx==1}">
                           <input type="checkbox" id="cb_${item.param_code}" name="cb_weather" ${item.bool==true?"checked":""} value="${item.param_code}">
                           </c:if>
                           <c:if test="${rssForm.rssInfo.cbx==0}">
                           <input type="checkbox" id="cb_${item.param_code}" name="cb_weather" disabled value="${item.param_code}">
                           </c:if>
                           [${item.param_code}]${item.param_name}
                           </NOBR>
                         </DIV>
        </td>
        <c:if test="${status.last}">
    <c:forEach var="i" begin="${status.index+1}" end="${2-(status.index)%4+status.index-1}">
        <td width="25%">&nbsp;</td>
    </c:forEach>
        </c:if>
                        </c:forEach>
                     </tr></table>
      

  3.   

    <style>
    li{float:left;}
    </style>
    <div style="width:200px;">
       <ul>
         <%--loop--%>
         <logic:iterator>
         <li></li>
         </logic:iterator>
       </ul>
    </div>
    调整div的宽度,就可以调整一行显示的数量。
      

  4.   

    条件判断下啊。。给个思路。。
    if(i%2==0){
    <tr>
    }
    <td>
    </td>
    if(i%2==1){
    </tr>
    }
      

  5.   

    先用for循环实现以下你的效果,再说一下 logic:iterate 与for循环的类似之处;<table>
    <%for(int i=0;i<objs.length;i++){%>
    <%if(i%2=0){out.print("<tr>");}%>      //这里控制 两列才换一行;<td><%=i%>    <%=objs[i]%></td><%if(i%2=1){out.print("</tr>");}%>    //这里控制 两列才换一行;
    <%}%>
    </table>logic:iterate 与for循环 类似
    <logic:iterate   indexId="index"   id="Item"   name="objs" >  
    <%for(int i=0;i<objs.length;i++){%>iterate  中的 index 相当于 for 中的 i
    iterate  中的 Item 相当于 for 中的 objs[i]         
      

  6.   

    logic:iterate  循环<td>
      

  7.   

    在<table/>里面 用 <for:Each/> 循环 就可以达到.
    <for:Each/>是jstl里面的标签.你得导入jstl