jstl判断List是否为空
JSP页面开头要包含
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
从controller拿到List以后,jsp页面判断并展示:
<c:if test="${userList!=null && fn:length(userList) > 0}">
<label>XXX</label>
<c:forEach var="user" items="${userList}">
<li>${user}</li>
</c:forEach>
</c:if>
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
