commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wer...@apache.org
Subject cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/impl DynamicTag.java
Date Thu, 22 May 2003 22:25:34 GMT
werken      2003/05/22 15:25:33

  Modified:    jelly/src/java/org/apache/commons/jelly/impl DynamicTag.java
  Log:
  Exposing dynamic tag attributes Map as ${attrs}
  
  Revision  Changes    Path
  1.7       +12 -0     jakarta-commons/jelly/src/java/org/apache/commons/jelly/impl/DynamicTag.java
  
  Index: DynamicTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/impl/DynamicTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DynamicTag.java	10 Mar 2003 13:00:51 -0000	1.6
  +++ DynamicTag.java	22 May 2003 22:25:33 -0000	1.7
  @@ -63,6 +63,7 @@
   
   import java.util.HashMap;
   import java.util.Map;
  +import java.util.Iterator;
   
   import org.apache.commons.jelly.DynaTagSupport;
   import org.apache.commons.jelly.JellyContext;
  @@ -110,6 +111,17 @@
           
           // create new context based on current attributes
           JellyContext newJellyContext = context.newJellyContext(attributes);
  +        Map attrMap = new HashMap();
  +        for ( Iterator keyIter = this.attributes.keySet().iterator();
  +              keyIter.hasNext();) {
  +            String key = (String) keyIter.next();
  +            if ( key.endsWith( "Attr" ) ) {
  +                Object value = this.attributes.get( key );
  +                attrMap.put( key, value );
  +                attrMap.put( key.substring( 0, key.length()-4 ), value );
  +            }  
  +        }
  +        newJellyContext.setVariable( "attrs", attrMap );
           getTemplate().run(newJellyContext, output);
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message