程序员一代码搬运工
【Java学习心得和Java学习技术个人总结】

jsp for循环 匹配map (el表达式)

 

控制器

Map<String,Boolean> map= new HashMap<String, Boolean>();
for(Video v :videoList){
map.put(v.getOid()+"", false);
}

 

for (VideoRecord videoRecord : videoRecordList) {
			map.put(videoRecord.getVideo().getOid()+"", true);
		}

jsp

<c:forEach items="${videoList}" var="video">
                              <c:if test="${map[''.concat(video.oid)]}"> 
                               <p   class="color_66"   id="title_${video.oid}"   onclick = "getDetail('videodetail_${video.oid}')">
		                        	<span><img src="<c:url value='/resources/risk/images/public/pss_video.jpg' />" width="18" height="18">${video.videoName }</span>
		                            <span>已观看</span>
		                       </p>
		                       </c:if> 
		                       <c:if test="${map[''.concat(video.oid)] eq false}"> 
		               			  <p  id="title_${video.oid}"   onclick = "getDetail('videodetail_${video.oid}')">
		                        	<span><img src="<c:url value='/resources/risk/images/public/pss_video.jpg' />" width="18" height="18">${video.videoName }</span>
		                            <span>未观看</span>
		                          </p>
							    </c:if> 
     					<div class="clear"></div>
			       </c:forEach>

 

赞(0)
未经允许不得转载:程序员一代码搬运工 » jsp for循环 匹配map (el表达式)
分享到: 更多 (0)