Small patch related to <logic:empty> for your consideration.  The intent of 
the change is to make <logic:empty> (and therefore <logic:notEmpty>) handle 
a Map in the same way it currently handles a Collection.

Thanks
Robert Rasmussen

Index: doc/userGuide/struts-logic.xml
===================================================================
RCS file: /home/cvspublic/jakarta-struts/doc/userGuide/struts-logic.xml,v
retrieving revision 1.6
diff -u -r1.6 struts-logic.xml
--- doc/userGuide/struts-logic.xml      3 Aug 2002 18:43:40 -0000       1.6
+++ doc/userGuide/struts-logic.xml      11 Oct 2002 20:53:27 -0000
@@ -80,8 +80,9 @@
     <info>
     <p>This tag evaluates its nested body content only if the specified 
value
     is either absent (i.e. <code>null</code>), an empty string (i.e. a
-    <code>java.lang.String</code> with a length of zero) or an empty 
java.util.Collection
-    (tested by the .isEmpty() method on the java.util.Collection 
interface).</p>
+    <code>java.lang.String</code> with a length of zero), or an empty
+    java.util.Collection or java.util.Map (tested by the .isEmpty() method 
on
+    the java.util.Collection or java.util.Map interface, respectively).</p>
     </info>

     <attribute>
Index: src/share/org/apache/struts/taglib/logic/EmptyTag.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java,v
retrieving revision 1.3
diff -u -r1.3 EmptyTag.java
--- src/share/org/apache/struts/taglib/logic/EmptyTag.java      25 Jun 2002 
00:53:41 -0000  1.3
+++ src/share/org/apache/struts/taglib/logic/EmptyTag.java      11 Oct 2002 
20:53:28 -0000
@@ -63,6 +63,7 @@
package org.apache.struts.taglib.logic;

import java.util.Collection;
+import java.util.Map;
import javax.servlet.jsp.JspException;
import org.apache.struts.util.RequestUtils;

@@ -121,6 +122,9 @@
                 } else if (value instanceof Collection) {
                     Collection collValue = (Collection)value;
                     empty = collValue.isEmpty();
+                } else if (value instanceof Map) {
+                       Map mapValue = (Map)value;
+                       empty = mapValue.isEmpty();
                 } else {
                     empty = false;
                 }









_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to