在jsp頁面導入函數標簽庫:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
list的長度是:${fn:length(list)}
就可以在頁面標簽中對后台傳過來的list的長度進行判斷
<c:if test="${fn:length(list)<=0}"> <img style="width:100%;height:auto;" src="${contextPath}/webpage/weixin/noInfo.png" alt=""> </c:if>
在jsp頁面中不能通過${list.size}取列表長度。
