Oceń czy lista jest pusta JSTL
Próbowałem ocenić, czy ta lista tablic jest pusta, czy nie, ale żadna z nich nie została skompilowana:
<c:if test="${myObject.featuresList.size == 0 }">
<c:if test="${myObject.featuresList.length == 0 }">
<c:if test="${myObject.featuresList.size() == 0 }">
<c:if test="${myObject.featuresList.length() == 0 }">
<c:if test="${myObject.featuresList.empty}">
<c:if test="${myObject.featuresList.empty()}">
<c:if test="${myObject.featuresList.isEmpty}">
Jak mogę ocenić, czy ArrayList jest pusty?
114
2 answers
Empty jest operatorem.
<c:if test="${empty myObject.featuresList}">
229
Author: bobince,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-02-15 08:28:55
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-02-15 08:28:55
Są też znaczniki funkcji, nieco bardziej elastyczne:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:if test="${fn:length(list) > 0}">
I Oto dokumentacja tagu.
63
Author: Steve B.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-09-23 03:07:08
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-09-23 03:07:08