[PATCH] handle maps in logic:empty/logic:notEmpty

2002-10-13 Thread Robert Rasmussen

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 -   1.6
+++ doc/userGuide/struts-logic.xml  11 Oct 2002 20:53:27 -
@@ -80,8 +80,9 @@
 info
 pThis tag evaluates its nested body content only if the specified 
value
 is either absent (i.e. codenull/code), an empty string (i.e. a
-codejava.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
+codejava.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 -  1.3
+++ src/share/org/apache/struts/taglib/logic/EmptyTag.java  11 Oct 2002 
20:53:28 -
@@ -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]




Re:[PATCH] handle maps in logic:empty/logic:notEmpty

2002-10-12 Thread Robert Leland

 Robert Rasmussen [EMAIL PROTECTED]
  Small patch related to logic:empty for your consideration.  The 
intent of

Robert, best place to put this is in Buzilla:
http://nagoya.apache.org/bugzilla/
 If you don't have an account it only takes a minute to fill out the 
no-nonsense form.

-Rob



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