我现在是在JSP里做程序,我可以把数据拿出来放到RS里,单循环tr可以循环成12行的,也可以循环td把它循环显示成12列的,但是我需要把它做成2行6列的,这个怎么做啊?!怎么循环才能出来?
请教!

解决方案 »

  1.   

    <tr>
    for(int j = 0; j < 12; i++;j++){
       <td>第j个数据</td>
       if(i == 5) </tr><tr>
    }
    </tr>
    写的比较简,意思应该理解吧?
      

  2.   

    <table border="0">
      <tr>
       <logic:iterate id="temp" name="templatearray" indexId="index">
        <td>
          <bean:write name="temp" property="templatename" />
        </td>
        <%-- 控制换行,每行6列 --%>
        <c:if test="${(index+1)%6 == 0}">
         </tr>
          <tr>
        </c:if>
       </logic:iterate>
      </tr>
    </table>
      

  3.   

    你要是知道HTML怎么换行还会不明白吗