首页 > 代码库 > 关于<forEach>的<if>混合使用显示数据

关于<forEach>的<if>混合使用显示数据

<c:forEach items="${rankingList}" var="p" varStatus="status">
                     <div class="my-comment-list">
                        <div class="my-o-cons clearfix">
                            <div class="my-con-img" style="height: 18%;">
                                <c:if test="${not empty p.image}">
                                      <img src="${res}/upload/${p.wechatId}/${p.image}">
                                </c:if>
                                <c:if test="${empty p.image}">
                                      <img src="${res}/template/activityVote/wlmz/images/p.png">
                                </c:if>    
                                <div class="bian"><p>编号:${p.note2}</p></div>
                             </div>
                                 <div class="my-con-txtf">
                                       <p>${p.name}</p>
                                       <p class="f2">${p.danceTypes}</p>
                                 </div>
                                 <div class="two">
                                  <p>
                                    <span>
                                        <img src="${res}/template/activityVote/wlmz/images/p4.png">
                                    </span>
                                    ${p.freeAmount}
                                  </p>
                                  <p class="f2">
                                    <span>
                                       <img src="${res}/template/activityVote/wlmz/images/p5.png">
                                    </span>
                                     ${p.costAmount}
                                  </p>
                                </div>
                                <c:if test="${status.index==0}">
                                    <div class="fr">
                                       <img src="${res}/template/activityVote/wlmz/images/h1.png">
                                    </div>
                                </c:if>
                                <c:if test="${status.index==1}">
                                    <div class="fr">
                                       <img src="${res}/template/activityVote/wlmz/images/h2.png">
                                    </div>
                                </c:if>
                                <c:if test="${status.index==2}">
                                    <div class="fr">
                                       <img src="${res}/template/activityVote/wlmz/images/h3.png">
                                    </div>
                                </c:if>
                                <c:if test="${status.index>2}">
                                      <div class="fr">
                                         <p>第${status.index+1}名</p> 
                                      </div>
                                </c:if>
                             </div>
                         </div>
                                
                         <div class="fjx"></div>
                </c:forEach>

 

关于<forEach>的<if>混合使用显示数据