You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by sh...@apache.org on 2002/04/17 15:56:42 UTC

cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/core RemoveTag.java

shawn       02/04/17 06:56:42

  Modified:    standard/conf c-rt.tld c.tld
  Added:       standard/src/org/apache/taglibs/standard/tag/common/core
                        RemoveTag.java
  Removed:     standard/src/org/apache/taglibs/standard/tag/el/core
                        RemoveTag.java
  Log:
  <c:remove> now exists in RT library
  
  Revision  Changes    Path
  1.14      +19 -0     jakarta-taglibs/standard/conf/c-rt.tld
  
  Index: c-rt.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/conf/c-rt.tld,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- c-rt.tld	17 Apr 2002 13:22:18 -0000	1.13
  +++ c-rt.tld	17 Apr 2002 13:56:41 -0000	1.14
  @@ -268,6 +268,25 @@
     </tag>
   
     <tag>
  +    <name>remove</name>
  +    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
  +    <body-content>empty</body-content>
  +    <description>
  +        Removes a scoped variable (from a particular scope, if specified).
  +    </description>
  +    <attribute>
  +        <name>var</name>
  +        <required>true</required>
  +        <rtexprvalue>false</rtexprvalue>
  +    </attribute>
  +    <attribute>
  +        <name>scope</name>
  +        <required>false</required>
  +        <rtexprvalue>false</rtexprvalue>
  +    </attribute>
  +  </tag>
  +
  +  <tag>
       <name>url</name>
       <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
       <body-content>JSP</body-content>
  
  
  
  1.16      +1 -1      jakarta-taglibs/standard/conf/c.tld
  
  Index: c.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/conf/c.tld,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- c.tld	17 Apr 2002 13:22:18 -0000	1.15
  +++ c.tld	17 Apr 2002 13:56:41 -0000	1.16
  @@ -317,7 +317,7 @@
   
     <tag>
       <name>remove</name>
  -    <tag-class>org.apache.taglibs.standard.tag.el.core.RemoveTag</tag-class>
  +    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
       <body-content>empty</body-content>
       <description>
   	Removes a scoped variable (from a particular scope, if specified).
  
  
  
  1.1                  jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/core/RemoveTag.java
  
  Index: RemoveTag.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:  
   *       "This product includes software developed by the 
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */ 
  
  package org.apache.taglibs.standard.tag.common.core;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  import org.apache.taglibs.standard.tag.common.core.*;
  import org.apache.taglibs.standard.resources.Resources;
  
  /**
   * <p>A handler for the &lt;remove&gt; tag, which removes the variable
   * identified by 'var' (and 'scope', if present).
   *
   * @author Shawn Bayern
   */
  public class RemoveTag extends TagSupport {
  
      //*********************************************************************
      // 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 int scope;					// tag attribute
      private boolean scopeSpecified;			// ... by tag attribute
      private String var;					// tag attribute
  
  
      //*********************************************************************
      // Construction and initialization
  
      /**
       * Constructs a new handler.  As with TagSupport, subclasses should
       * not provide other constructors and are expected to call the
       * superclass constructor.
       */
      public RemoveTag() {
          super();
          init();
      }
  
      // resets local state
      private void init() {
          var = null;
          scope = PageContext.PAGE_SCOPE;
          scopeSpecified = false;
      }
  
      // Releases any resources we may have (or inherit)
      public void release() {
          super.release();
          init();
      }
  
  
      //*********************************************************************
      // Tag logic
  
      // removes the variable (from a specific scope, if specified)
      public int doEndTag() throws JspException {
          if (!scopeSpecified)
              pageContext.removeAttribute(var);
          else
              pageContext.removeAttribute(var, scope);
  	return EVAL_PAGE;
      }
  
  
      //*********************************************************************
      // Accessor methods
  
      // for tag attribute
      public void setVar(String var) {
  	this.var = var;
      }
  
      // for tag attribute
      public void setScope(String scope) {
          this.scope = Util.getScope(scope);
  	scopeSpecified = true;
      }
  }
  
  
  

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