You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by pr...@apache.org on 2003/09/04 03:54:27 UTC

cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core ImportTag.java RemoveTag.java

proyal      2003/09/03 18:54:27

  Modified:    jelly/src/java/org/apache/commons/jelly/tags/core
                        ImportTag.java RemoveTag.java
  Log:
  [JELLY-87] Allow var of RemoveTag to be an expression
  
  Patch from Robert McIntosh
  
  Revision  Changes    Path
  1.7       +7 -7      jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/ImportTag.java
  
  Index: ImportTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/ImportTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImportTag.java	24 Jan 2003 22:53:34 -0000	1.6
  +++ ImportTag.java	4 Sep 2003 01:54:27 -0000	1.7
  @@ -101,7 +101,6 @@
   
       /**
        * Create a new Import tag.
  -     * @see java.lang.Object#Object()
        */
       public ImportTag() {
       }
  @@ -112,7 +111,8 @@
       /**
        * Perform tag processing
        * @param output the destination for output
  -     * @throws Exception Any exception can be thrown
  +     * @throws MissingAttributeException if a required attribute is missing
  +     * @throws JellyTagException on any other errors
        */ 
       public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
           if (uri == null && file == null) {
  
  
  
  1.4       +4 -3      jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/RemoveTag.java
  
  Index: RemoveTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/tags/core/RemoveTag.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RemoveTag.java	24 Jan 2003 22:53:34 -0000	1.3
  +++ RemoveTag.java	4 Sep 2003 01:54:27 -0000	1.4
  @@ -64,6 +64,7 @@
   import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.commons.jelly.XMLOutput;
  +import org.apache.commons.jelly.expression.Expression;
   
   /** 
    * A tag which removes the variable of the given name from the current variable scope.
  @@ -73,7 +74,7 @@
    */
   public class RemoveTag extends TagSupport {
   
  -    private String var;
  +    private Expression var;
   
       public RemoveTag() {
       }
  @@ -82,7 +83,7 @@
       //------------------------------------------------------------------------- 
       public void doTag(XMLOutput output) throws MissingAttributeException {
           if (var != null) {
  -            context.removeVariable(var);
  +            context.removeVariable( var.evaluateAsString(context) );
           }
           else {
               throw new MissingAttributeException("var");
  @@ -95,7 +96,7 @@
       /**
        * Sets the name of the variable which will be removed by this tag..
        */
  -    public void setVar(String var) {
  +    public void setVar(Expression var) {
           this.var = var;
       }
   }