You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ar...@apache.org on 2002/04/06 20:59:30 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/nested/logic NestedIterateTag.java

arron       02/04/06 10:59:30

  Modified:    src/share/org/apache/struts/taglib/nested/logic
                        NestedIterateTag.java
  Log:
  Adding the ability to nest through HashMap collections.
  Supported by original tag, and recently BeanUtils.
  Child tags will now get the correct "beanProperty(key)" property reference
  from this tag for nesting.
  
  Revision  Changes    Path
  1.4       +11 -5     jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTag.java
  
  Index: NestedIterateTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NestedIterateTag.java	13 Mar 2002 13:13:28 -0000	1.3
  +++ NestedIterateTag.java	6 Apr 2002 18:59:30 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTag.java,v 1.3 2002/03/13 13:13:28 arron Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/03/13 13:13:28 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTag.java,v 1.4 2002/04/06 18:59:30 arron Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/04/06 18:59:30 $
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
  @@ -59,6 +59,7 @@
    */
   package org.apache.struts.taglib.nested.logic;
   
  +import java.util.*;
   import javax.servlet.jsp.*;
   import javax.servlet.jsp.tagext.*;
   import javax.servlet.http.HttpSession;
  @@ -73,7 +74,7 @@
    *
    * @author Arron Bates
    * @since Struts 1.1
  - * @version $Revision: 1.3 $ $Date: 2002/03/13 13:13:28 $
  + * @version $Revision: 1.4 $ $Date: 2002/04/06 18:59:30 $
    */
   public class NestedIterateTag extends IterateTag implements NestedParentSupport, NestedNameSupport {
     
  @@ -83,7 +84,12 @@
      * @return String value of the property and the current index.
      */
     public String getNestedProperty() {
  -    return property + "["+ this.getIndex() +"]";
  +    Object idObj = pageContext.getAttribute(id);
  +    if (idObj instanceof Map.Entry) {
  +      return property + "("+ ((Map.Entry)idObj).getKey() +")";
  +    } else {
  +      return property + "["+ this.getIndex() +"]";
  +    }
     }
   
     /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>