struts2的强大迭代标签:<s:iterator>

源码:

Action逻辑:

        List listb = sjspService.getReportList(ksrq, jzrq);
        List lista = sjspService.getUploadList(ksrq, jzrq);
        request.setAttribute("la", lista);
        request.setAttribute("lb", listb);

jsp展示:

<s:iterator value="#request.la" id="id" status="status" >
      <tr>
        <td><s:property value='#request.la[#status.index].YWSJ'/></td>
        <td><s:property value='#request.la[#status.index].YLJGDM'/></td>
        <s:if test="#request.lb[#status.index].MZRC==#request.la[#status.index].MZRC">
            <td><s:property value='#request.la[#status.index].MZRC'/></td>
            <td><s:property value='#request.lb[#status.index].MZRC'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].MZRC'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].MZRC'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].JZRC==#request.la[#status.index].JZRC">
            <td><s:property value='#request.la[#status.index].JZRC'/></td>
            <td><s:property value='#request.lb[#status.index].JZRC'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].JZRC'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].JZRC'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].RYRC==#request.la[#status.index].RYRC">
            <td><s:property value='#request.la[#status.index].RYRC'/></td>
            <td><s:property value='#request.lb[#status.index].RYRC'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].RYRC'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].RYRC'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].CYRC==#request.la[#status.index].CYRC">
            <td><s:property value='#request.la[#status.index].CYRC'/></td>
            <td><s:property value='#request.lb[#status.index].CYRC'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].CYRC'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].CYRC'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].ZYRS==#request.la[#status.index].ZYRS">
            <td><s:property value='#request.la[#status.index].ZYRS'/></td>
            <td><s:property value='#request.lb[#status.index].ZYRS'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].ZYRS'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].ZYRS'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].SYCWS==#request.la[#status.index].SYCWS">
            <td><s:property value='#request.la[#status.index].SYCWS'/></td>
            <td><s:property value='#request.lb[#status.index].SYCWS'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].SYCWS'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].SYCWS'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].MJZYLFY==#request.la[#status.index].MJZYLFY">
            <td><s:property value='#request.la[#status.index].MJZYLFY'/></td>
            <td><s:property value='#request.lb[#status.index].MJZYLFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].MJZYLFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].MJZYLFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].ZYYLFY==#request.la[#status.index].ZYYLFY">
            <td><s:property value='#request.la[#status.index].ZYYLFY'/></td>
            <td><s:property value='#request.lb[#status.index].ZYYLFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].ZYYLFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].ZYYLFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].MJZYPFY==#request.la[#status.index].MJZYPFY">
            <td><s:property value='#request.la[#status.index].MJZYPFY'/></td>
            <td><s:property value='#request.lb[#status.index].MJZYPFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].MJZYPFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].MJZYPFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].ZYYPFY==#request.la[#status.index].ZYYPFY">
            <td><s:property value='#request.la[#status.index].ZYYPFY'/></td>
            <td><s:property value='#request.lb[#status.index].ZYYPFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].ZYYPFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].ZYYPFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].MJZYBYLFY==#request.la[#status.index].MJZYBYLFY">
            <td><s:property value='#request.la[#status.index].MJZYBYLFY'/></td>
            <td><s:property value='#request.lb[#status.index].MJZYBYLFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].MJZYBYLFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].MJZYBYLFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].ZYYBYLFY==#request.la[#status.index].ZYYBYLFY">
            <td><s:property value='#request.la[#status.index].ZYYBYLFY'/></td>
            <td><s:property value='#request.lb[#status.index].ZYYBYLFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].ZYYBYLFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].ZYYBYLFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].MJZYBYPFY==#request.la[#status.index].MJZYBYPFY">
            <td><s:property value='#request.la[#status.index].MJZYBYPFY'/></td>
            <td><s:property value='#request.lb[#status.index].MJZYBYPFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].MJZYBYPFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].MJZYBYPFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].ZYYBYPFY==#request.la[#status.index].ZYYBYPFY">
            <td><s:property value='#request.la[#status.index].ZYYBYPFY'/></td>
            <td><s:property value='#request.lb[#status.index].ZYYBYPFY'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].ZYYBYPFY'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].ZYYBYPFY'/></td>
        </s:else>
        <s:if test="#request.lb[#status.index].ZYSJFSYS==#request.la[#status.index].ZYSJFSYS">
            <td><s:property value='#request.la[#status.index].ZYSJFSYS'/></td>
            <td><s:property value='#request.lb[#status.index].ZYSJFSYS'/></td>
        </s:if>
        <s:else>
            <td class="fc"><s:property value='#request.la[#status.index].ZYSJFSYS'/></td>
            <td class="fc"><s:property value='#request.lb[#status.index].ZYSJFSYS'/></td>
        </s:else>
      </tr>
  </s:iterator>

上面是2个list的同步与不同步的同时处理解决方案。有了上例,再多的list的处理,也是类似了。留下以后以备使用。

转载于:https://www.cnblogs.com/sfmjp/archive/2013/02/21/2921383.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值