<table border="0" align="center" width="700">
 <s:iterator value="#request.paginationSupport.items" status="index" >  
    <s:if test="#index.odd||#index.first">   
       <tr>       
    </s:if>   
          <td>   
             ${pictures.picture}
             ${pictures.plei}
             来自:${users.uname}
          </td>   
     <s:if test="#index.even||#index.last">   
      <tr>       
    </s:if>   
 </s:iterator>  
</table>
我现在 <s:iterator></s:iterator> 标签的 if test判断的语句是一个tr内显示的2个td循环的
那么这个判断语句怎么写<s:if test="#index.odd||#index.first"><tr></s:if> 
<s:if test="#index.even||#index.last"> <tr> </s:if>才能在一个<tr>内显示4个td呢,请各位帮个忙 3Q

解决方案 »

  1.   

    一个tr内显示的2个td循环
    你的代码中只有一个<td>呀~~
    而且我没有看到你的<tr>对应的结束标签</tr>
      

  2.   

    这是iterator 循环 从数据库将数据放在items 用iterator循环出来 是
    <s:if test="#index.odd||#index.first">  
          <tr>      
        </s:if> <s:if test="#index.even||#index.last">  
          <tr>      
        </s:if> 
    判断数据库中数据在页面上一排显示多少个 数据
      

  3.   

    我不知道是不是我理解的有问题,对于一楼疑问,你还是没有说
    想问一下,你在什么时个能把</tr>这个行结束的标签输出出来??
      

  4.   

    if中添加循环的变量index%4,进行判断
      

  5.   

    <s:iterator value="lst" status="l1">
    <s:if test="#l1.index % 4 == 0">
    <tr>
    </s:if>
    <td width="115">
    <s:property value="qxValue"/>
    </td>
        <s:if test="#l1.count % 4 == 0">
          </tr>      
        </s:if>
    </s:iterator>
      

  6.   

    o  这样啊 呵呵 后来用的这个方法
    <s:if test="#index.modulus(4)==0">
     <s:if test="#index.last">
    <%out.print("</tr>"); %>
    </s:if>
    <s:else>
    <%out.print("</tr><tr>"); %>
     </s:else>
    </s:if>不过还是很3Q啦