Velocity多重foreach嵌套循环

#macro(list $list $listClass $listItemSize)
	<div class="menu_nav clearfix">
    	<ul class="${listClass}">
            #foreach($ele in $list)
				#set($index = ${velocityCount} - 1)
				#foreach($item in $list.get($index))
					#foreach($li in $item)
					    <li>	
                                                   <a id="moduleId_${li.get('articleId')}" href="${li.get('href')}">${li.get('name')}</a>
                    	                    </li>
					#end
    			#end
        	#end
    	</ul>
	</div>
#end
#list($list $listClass $listItemSize)

 

#foreach($category in $categoryList)

   #foreach($charpter in $categrory)

   #end

#end

 

// 实战实例

#foreach($!room in $!hotelDetail.rooms) 
#foreach($!ratePlan in $!room.ratePlans) 
#if($!{ratePlan.status})
<li class="room_list_container">
	<table
		width="624"
		cellspacing="0"
		cellpadding="0"
		border="0">
		<tr>
			<td
				width="74"
				rowspan="3"><img
				style="width: 67px; height: 67px; border: 3px solid #ababab"
				src="../images/hotel/hotel_pic2.jpg"></img></td>
			<td
				width="10"
				rowspan="3"></td>
			<td
				class="size18 white"
				colspan="2">$!{room.name}</td>
			<td
				class="text_center roomDetailBtn"
				width="95"
				rowspan="3"
				name="$!{room.name}"
				ratePlanName="$!{ratePlan.ratePlanName}"
				floor="$!{room.floor}"
				network="$!{room.broadnet}"
				bedType="$!{room.bedType}"
				description="$!{room.description}"
				comments="$!{room.comments}"><img
				src="../images/hotel/fangjianxiangqing.png"></img></td>
			<td
				class="text_center"
				width="39"
				rowspan="3"></td>
			<td
				class="size24 brightblue19"
				valign="bottom"
				colspan="2">$!{ratePlan.totalRate}元</td>
			<td
				width="17"
				rowspan="3"></td>
			<td
				width="59"
				rowspan="3"
				class="bookHotelBtn"
				hotelId="$!{hotelDetail.hotelId}"
				ratePlanId="$!{ratePlan.ratePlanId}"
				roomTypeId="$!{ratePlan.roomTypeId}"><img
				src="/images/hotel/book_room_btn.png"></td>
			<td
				width="10"
				rowspan="3"></td>
		</tr>
		<tr>
			<td
				class="size12 white"
				valign="top">$!{ratePlan.ratePlanName}</td>
			<td
				class="size12 white"
				valign="top">$!{room.broadnet}</td>
			<td
				width="28"
				valign=""
				rowspan="2"></td>
			<td
				class="size14 orange01"
				width="80"
				valign="top"
				rowspan="2"></td>
		</tr>
		<tr>
			<td
				class="size12 white"
				valign="top">$!{room.floor}层</td>
			<td
				class="size12 white"
				valign="top"></td>
		</tr>
	</table>
</li>
#end 
#end 
#end

 

 

你可能感兴趣的:(循环,velocity,foreach)