struts2的2重遍历,看看代码。。。。



${location} 
${number} 
${status} 
${people}


已预订/s:if
/s:iterator
未预订/s:else

            <td class="shenqing">
                <s:iterator value="roomManagers">
                    <s:if test="#useDate1.equals(useDate.toString())==false">     
                        申请
                    </s:if>
                    <s:else>
                    <s:a id="%{id}" action="flow_submitUI.action?templateId=11&meetRoomId=%{id}&useDate=%{useDate1}">申请</s:a>
                    </s:else>
                </s:iterator>
            </td>
        </tr>
        </s:iterator>

        我要遍历,meetRoomList里面的roomManagers,并且遍历两次,怎么不可以啊,帮忙看看,谢谢了

思路:
1,正常语法上支持嵌套遍历的,和for(){ for },,一个道理
2,如果想遍历需要list,或者map这样的数据结构
3,如果这都满足,就看你的写法上是否有问题,建议你先不要写里面的s:iterator,先遍历外层,如果外层没问题了,再遍历内层的,

jsp 中没有s:if 配对s:else的情况,只有s:if 如果想实现 if else 可以用/c:when/c:otherwise/c:choose

 <c:choose>
   <c:when test="#useDate1.equals(useDate.toString())==false">  
        申请       
   </c:when>
   <c:otherwise> 
   <s:a id="%{id}" action="flow_submitUI.action?templateId=11&meetRoomId=%{id}&useDate=%{useDate1}">申请</s:a>
   </c:otherwise>
</c:choose>