DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6553>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6553

logic:iterate

           Summary: logic:iterate
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The struts logic:iterate tag doesn't except arrays of primitives to iterate 
over.  I've included a relatively simple patch that allows this, and makes the 
logic:iterate tag much more intuitive and complete as it will handle 
collections and arrays of anything appropriately.


Could a person with access to the tree PLEASE COMMENT on this to me either 
publically or privately, as I would like to do my best to see this included in 
the 1.1.x release.

--- jakarta-struts-1.0.1-
src/src/share/org/apache/struts/taglib/logic/IterateTag.java   Wed Jun 13 
22:24:28 2001
+++ jakarta-struts-1.0.1-src-
mfr/src/share/org/apache/struts/taglib/logic/IterateTag.java Thu Jan 31 
09:31:30 2002
@@ -310,9 +310,15 @@


        // Construct an iterator for this collection
-       if (collection.getClass().isArray())
-           collection = Arrays.asList((Object[]) collection);
-       if (collection instanceof Collection)
+       if (collection.getClass().isArray()) {
+               int length = java.lang.reflect.Array.getLength(collection);
+               Collection c = new ArrayList();
+               for(int i=0; i<length; i++) {
+                       c.add(java.lang.reflect.Array.get(collection, i));
+               }
+           iterator = c.iterator();
+       }
+       else if (collection instanceof Collection)
            iterator = ((Collection) collection).iterator();
        else if (collection instanceof Iterator)
            iterator = (Iterator) collection;

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

Reply via email to