天天看點

EL學習筆記

總結:

1. 使用<c:forEach>與<c:if>進行隔行換色 

<c:forEach var=”item” items=”${list}”  varStatus=”statu”>

<p <c:if test=${statu.index%2==0}>style=”backgrounde:red”</c:if>> ${item}</p>

</c:forEach>

2.簡單使用<c:forEach>進行隔行換色

<c:forEach var=”item” items=”${list}” varStatus=”statu”>

<p style=”${statu.inde%2==0?’background:red’:’’}”> ${item}</p>

</c:forEach>

3. <c:forEach> 通路數組

<c:forEach items="${array}" var="item" varStatus="i">

方式一:${item }<br />

方式二:${array[i.index] }<br />

</c:forEach>

4. <c:forEach> 通路List

<c:forEach items="${list}" var="item" varStatus="i">

方式一:${item}

方式二: ${list[i.index] }

</c:forEach>

5.  <c:forEach> 通路Map

<c:forEach items="${map}" var="item">

取key:${item.key}

取value: $itme.value}

</c:forEach>

繼續閱讀