jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core SetTag.java
Date Mon, 18 Mar 2002 23:01:10 GMT
shawn       02/03/18 15:01:10

  Modified:    standard/src/org/apache/taglibs/standard/tag/el/core
                        SetTag.java
  Log:
  Bug #7223.
  
  Revision  Changes    Path
  1.3       +10 -27    jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core/SetTag.java
  
  Index: SetTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core/SetTag.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SetTag.java	4 Feb 2002 02:39:51 -0000	1.2
  +++ SetTag.java	18 Mar 2002 23:01:10 -0000	1.3
  @@ -71,23 +71,12 @@
   public class SetTag extends BodyTagSupport {
   
       //*********************************************************************
  -    // Constants
  -
  -    /* We support these 'scopes'. */
  -
  -    private final String APPLICATION = "application";
  -    private final String SESSION = "session";
  -    private final String REQUEST = "request";
  -    private final String PAGE = "page";
  -
  -    //*********************************************************************
       // Internal state
   
       private String value;                               // tag attribute
  -    private String scope;				// tag attribute
  +    private int scope;					// tag attribute
       private String var;					// tag attribute
   
  -
       //*********************************************************************
       // Construction and initialization
   
  @@ -103,7 +92,8 @@
   
       // resets local state
       private void init() {
  -        value = scope = var = null;
  +        value = var = null;
  +	scope = PageContext.PAGE_SCOPE;
       }
   
       // Releases any resources we may have (or inherit)
  @@ -126,8 +116,11 @@
               // ... evaluating our expression
               result = ExpressionEvaluatorManager.evaluate(
                   "value", value, Object.class, this, pageContext);
  -	    if (result == null)
  -		throw new NullAttributeException("set", "value");
  +	    if (result == null) {
  +		// throw new NullAttributeException("set", "value");
  +		pageContext.removeAttribute(var, scope);
  +		return EVAL_PAGE;
  +	    }
   	} else {
   	    // ... retrieving and trimming our body
   	    if (bodyContent == null || bodyContent.getString() == null)
  @@ -142,17 +135,7 @@
            * is made to store something in the session without any
   	 * HttpSession existing).
            */
  -	if (scope == null || scope.equals(PAGE))
  -	    pageContext.setAttribute(var, result, pageContext.PAGE_SCOPE);
  -	else if (scope.equals(APPLICATION))
  -	    pageContext.setAttribute(var, result, pageContext.APPLICATION_SCOPE);
  -	else if (scope.equals(SESSION))
  -	    pageContext.setAttribute(var, result, pageContext.SESSION_SCOPE);
  -	else if (scope.equals(REQUEST))
  -	    pageContext.setAttribute(var, result, pageContext.REQUEST_SCOPE);
  -	else
  -	    throw new JspTagException(
  -		Resources.getMessage("SET_BAD_SCOPE", scope));
  +	pageContext.setAttribute(var, result, scope);
   
   	return EVAL_PAGE;
       }
  @@ -173,6 +156,6 @@
   
       // for tag attribute
       public void setScope(String scope) {
  -        this.scope = scope;
  +        this.scope = Util.getScope(scope);
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message