tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Doud <>
Subject Problem with "empty" key word on a collection.
Date Thu, 13 Feb 2003 15:51:14 GMT

It appears that the empty keyword doesn't always
function on a collection.  I must be missing something

The folder object contains a collection of "content". 
The useBean tag isn't initializing the Folder object.
Its there so I can use scriptlet debugging code. 

What exactly does empty check to determine if a
collection is empty or not?  It looks like that
"empty" is checking if the folder.content is null or
not, not if its size is zero. 

Folder.getContent() returns a type of


Jsp code:

<c:set var="folder"

<jsp:useBean class="Folder" id="folder" scope="page"/>
Size = <%= folder.getContent().size() %><br>
IsEmpty = <%= folder.getContent().isEmpty() %><br>

<c:if test="${empty pageScope.folder.content}">
Folder is empty.

<jsp:useBean class="java.util.LinkedList" id="list"
Test Size = <%= list.size() %><br>
Test IsEmpty = <%= list.isEmpty() %><br>

<c:if test="${empty list}">
Test collection is empty.

Size = 0
IsEmpty = true
Test Size = 0
Test IsEmpty = true
Test collection is empty. 

Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message