咱們在前端遍歷後臺數據的時候,常常是從後臺傳過來一個數組或List集合,在前端頁面就可使用JSTL的<c:For each>標籤遍歷數據了。可是有時候咱們須要更加深刻控制遍歷的邏輯,這時候數組或List的長度就是一個必不可少的信息了。javascript
首先,在jsp頁面上,咱們不可以使用${testList.length}和${testList.size}來獲取List集合的長度,這是EL表達式的API決定的。前端
那麼,在jsp頁面上怎樣獲取數組或List集合的長度呢?java
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
${fn:length(testList)}
——例 如:數組
<c:if test="${varStatus.count==fn:length(allInform)-1}"> <a class="blue" >下移<i class="ace-icon glyphicon glyphicon-arrow-down bigger-130"></i> </a> </c:if> <c:if test="${varStatus.count!=fn:length(allInform)-1}"> <a class="blue" href="#" onclick="javascript:location.href='${pageContext.request.contextPath}/manager/toInformDown/${inform.get(‘inform_order’)}'"> 下移<i class="ace-icon glyphicon glyphicon-arrow-down bigger-130"></i> </a> </c:if>
———————————————————————————————————————————————————————————————————jsp
The end @ 萬有引力+
函數
-post
-spa
-code
-orm
-