dmkarr      2003/03/08 23:47:09

  Modified:    contrib/struts-el/src/share/org/apache/strutsel/taglib/logic
                        ELMatchTag.java ELNotMatchTag.java
  Log:
  Separated "expr" attribute into "expr" and "exprValue", being the original
  attribute value and the evaluated value.  Before this, a reused tag instance
  might not reevaluate the expression.
  
  Fixed probably long-standing bug in notMatch tag that made it behave
  identically to the "match" tag (instead of the reverse).  This is only with
  respect to the "expr" attribute, only used in the EL tag.
  
  Revision  Changes    Path
  1.7       +28 -8     
jakarta-struts/contrib/struts-el/src/share/org/apache/strutsel/taglib/logic/ELMatchTag.java
  
  Index: ELMatchTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/contrib/struts-el/src/share/org/apache/strutsel/taglib/logic/ELMatchTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ELMatchTag.java   9 Mar 2003 05:47:26 -0000       1.6
  +++ ELMatchTag.java   9 Mar 2003 07:47:09 -0000       1.7
  @@ -222,6 +222,25 @@
       public  void  setExpr(String expr) {
           this.expr = expr;
       }
  +
  +    /**
  +     * Evaluated value of expression.
  +     */
  +    private String   exprValue;
  +
  +    /**
  +     * Returns the evaluated expression.
  +     */
  +    public  String   getExprValue() {
  +        return (exprValue);
  +    }
  +
  +    /**
  +     * Sets the evaluated expression.
  +     */
  +    public  void  setExprValue(String exprValue) {
  +        this.exprValue  = exprValue;
  +    }
       
       /**
        * Releases state of custom tag so this instance can be reused.
  @@ -238,6 +257,7 @@
           setScopeExpr(null);
           setValueExpr(null);
           setExpr(null);
  +        setExprValue(null);
       }
       
       /**
  @@ -260,10 +280,10 @@
        */
       protected boolean condition(boolean desired) throws JspException {
           boolean   result   = false;
  -        if (getExpr() != null) {
  +        if (getExprValue() != null) {
               result   =
  -                ELMatchSupport.condition(desired, getExpr(), value, location,
  -                                         messages, pageContext);
  +                ELMatchSupport.condition(desired, getExprValue(), value,
  +                                         location, messages, pageContext);
           }
           else {
               result   = super.condition(desired);
  @@ -286,7 +306,7 @@
   
           if ((string = EvalHelper.evalString("expr", getExpr(),
                                               this, pageContext)) != null)
  -            setExpr(string);
  +            setExprValue(string);
   
           if ((string = EvalHelper.evalString("header", getHeaderExpr(),
                                               this, pageContext)) != null)
  
  
  
  1.7       +28 -8     
jakarta-struts/contrib/struts-el/src/share/org/apache/strutsel/taglib/logic/ELNotMatchTag.java
  
  Index: ELNotMatchTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/contrib/struts-el/src/share/org/apache/strutsel/taglib/logic/ELNotMatchTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ELNotMatchTag.java        9 Mar 2003 05:47:26 -0000       1.6
  +++ ELNotMatchTag.java        9 Mar 2003 07:47:09 -0000       1.7
  @@ -224,6 +224,25 @@
       }
   
       /**
  +     * Evaluated value of expression.
  +     */
  +    private String   exprValue;
  +
  +    /**
  +     * Returns the evaluated expression.
  +     */
  +    public  String   getExprValue() {
  +        return (exprValue);
  +    }
  +
  +    /**
  +     * Sets the evaluated expression.
  +     */
  +    public  void  setExprValue(String exprValue) {
  +        this.exprValue  = exprValue;
  +    }
  +
  +    /**
        * Releases state of custom tag so this instance can be reused.
        */
       public void release()
  @@ -238,6 +257,7 @@
           setScopeExpr(null);
           setValueExpr(null);
           setExpr(null);
  +        setExprValue(null);
       }
       
       /**
  @@ -260,10 +280,10 @@
        */
       protected boolean condition(boolean desired) throws JspException {
           boolean   result   = false;
  -        if (getExpr() != null) {
  +        if (getExprValue() != null) {
               result   =
  -                ELMatchSupport.condition(!desired, getExpr(), value, location,
  -                                         messages, pageContext);
  +                ELMatchSupport.condition(desired, getExprValue(), value,
  +                                         location, messages, pageContext);
           }
           else {
               result   = super.condition(desired);
  @@ -286,7 +306,7 @@
   
           if ((string = EvalHelper.evalString("expr", getExpr(),
                                               this, pageContext)) != null)
  -            setExpr(string);
  +            setExprValue(string);
   
           if ((string = EvalHelper.evalString("header", getHeaderExpr(),
                                               this, pageContext)) != null)
  
  
  

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

Reply via email to