Hi!

The attached src/doc minipatch enables the logic:empty tag to also deal
with collections.

It is diffed against the current cvs.

Thanks for considering it for intergration,
Erich

-- 
Dr. Erich Meier, Software Process Improvement
method park, Wetterkreuz 19a, 91058 Erlangen, Germany
Tel. +49-9131-97206-316  mailto:[EMAIL PROTECTED]
Fax. +49-9131-97206-200  http://www.methodpark.de/
Index: doc/userGuide/struts-logic.xml
===================================================================
RCS file: /home/cvspublic/jakarta-struts/doc/userGuide/struts-logic.xml,v
retrieving revision 1.2
diff -c -r1.2 struts-logic.xml
*** doc/userGuide/struts-logic.xml      16 Mar 2002 03:00:44 -0000      1.2
--- doc/userGuide/struts-logic.xml      19 Mar 2002 10:51:12 -0000
***************
*** 72,85 ****
      <name>empty</name>
      <summary>
      Evaluate the nested body content of this tag if the requested variable is
!     either <code>null</code> or an empty string.
      </summary>
      <tagclass>org.apache.struts.taglib.logic.EmptyTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
      <p>[Since 1.1] This tag evaluates its nested body content only if the specified 
value
      is either absent (i.e. <code>null</code>) or an empty string (i.e. a
!     <code>java.lang.String</code> with a length of zero).</p>
      </info>
  
      <attribute>
--- 72,86 ----
      <name>empty</name>
      <summary>
      Evaluate the nested body content of this tag if the requested variable is
!     either <code>null</code> or an empty string or an empty collection.
      </summary>
      <tagclass>org.apache.struts.taglib.logic.EmptyTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
      <p>[Since 1.1] This tag evaluates its nested body content only if the specified 
value
      is either absent (i.e. <code>null</code>) or an empty string (i.e. a
!     <code>java.lang.String</code> with a length of zero) or an empty
!     <code>java.lang.Collection</code>.</p>
      </info>
  
      <attribute>
***************
*** 1008,1021 ****
      <name>notEmpty</name>
      <summary>
      Evaluate the nested body content of this tag if the requested variable is
!     neither <code>null</code> nor an empty string.
      </summary>
      <tagclass>org.apache.struts.taglib.logic.NotEmptyTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
      <p>This tag evaluates its nested body content only if the specified value
      is present (i.e. not <code>null</code>) and is not an empty string (i.e. a
!     <code>java.lang.String</code> with a length of zero).</p>
      </info>
  
      <attribute>
--- 1009,1023 ----
      <name>notEmpty</name>
      <summary>
      Evaluate the nested body content of this tag if the requested variable is
!     neither <code>null</code> nor an empty string nor an empty collection.
      </summary>
      <tagclass>org.apache.struts.taglib.logic.NotEmptyTag</tagclass>
      <bodycontent>JSP</bodycontent>
      <info>
      <p>This tag evaluates its nested body content only if the specified value
      is present (i.e. not <code>null</code>) and is not an empty string (i.e. a
!     <code>java.lang.String</code> with a length of zero) and is not an empty
!     <code>java.lang.Collection</code>.</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.1
diff -c -r1.1 EmptyTag.java
*** src/share/org/apache/struts/taglib/logic/EmptyTag.java      8 Jul 2001 04:15:13 
-0000       1.1
--- src/share/org/apache/struts/taglib/logic/EmptyTag.java      19 Mar 2002 10:51:12 
-0000
***************
*** 63,68 ****
--- 63,69 ----
  package org.apache.struts.taglib.logic;
  
  
+ import java.util.Collection;
  import javax.servlet.jsp.JspException;
  import org.apache.struts.util.RequestUtils;
  
***************
*** 117,122 ****
--- 118,126 ----
                  if (value instanceof String) {
                      String strValue = (String)value;
                      empty = (strValue.length() < 1);
+                 } else if (value instanceof Collection) {
+                     Collection collValue = (Collection)value;
+                     empty = collValue.isEmpty();
                  } else {
                      empty = false;
                  }

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

Reply via email to