martinc 2002/10/12 12:19:18
Modified: src/share/org/apache/struts/taglib/logic EmptyTag.java
doc/userGuide struts-logic.xml
Log:
Add support for Map to <logic:empty> and <logic:notEmpty> tags.
PR: 13569
Submitted by: Robert Rasmussen - thanks for the patch.
Revision Changes Path
1.4 +8 -4
jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java
Index: EmptyTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EmptyTag.java 25 Jun 2002 00:53:41 -0000 1.3
+++ EmptyTag.java 12 Oct 2002 19:19:18 -0000 1.4
@@ -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;
}
1.7 +3 -2 jakarta-struts/doc/userGuide/struts-logic.xml
Index: struts-logic.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/doc/userGuide/struts-logic.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- struts-logic.xml 3 Aug 2002 18:43:40 -0000 1.6
+++ struts-logic.xml 12 Oct 2002 19:19:18 -0000 1.7
@@ -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
+ <code>java.util.Collection</code> or <code>java.util.Map</code> (tested by
+ the .isEmpty() method on the respective interface).</p>
</info>
<attribute>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>