You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by cm...@apache.org on 2002/08/01 16:42:57 UTC

cvs commit: jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl SetNamespaceTag.java SetDomainTag.java

cmlenz      2002/08/01 07:42:57

  Modified:    src/taglib slide-jstl.tld
  Added:       src/taglib/common/org/apache/slide/taglib/tag
                        SetDomainTagSupport.java
                        SetNamespaceTagSupport.java
               src/taglib/jstl/org/apache/slide/taglib/tag/jstl
                        SetNamespaceTag.java SetDomainTag.java
  Log:
  Added new tags 'setDomain' and 'setNamespace' that are functionally
  equivalent to the tags 'domain' and 'namespace', but expose the scripting
  variables after closing the tag instead of only in the body of the tag.
  
  This pattern is used in JSTL as well (see 'bundle' vs. 'setBundle'), so I 
  thought it'd be a good idea. It can improve readability of the JSP source
  by avoiding nesting overkill.
  
  Revision  Changes    Path
  1.1                  jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/SetDomainTagSupport.java
  
  Index: SetDomainTagSupport.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/DomainTagSupport.java,v 1.6 2002/04/25 21:12:33 jericho Exp $
   * $Revision: 1.6 $
   * $Date: 2002/04/25 21:12:33 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 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", "Slide", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag;
  
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.TagSupport;
  
  import org.apache.slide.taglib.bean.DomainBean;
  import org.apache.slide.taglib.util.Scopes;
  
  /**
   * Abstract foundation for tags that expose the Slide domain as a 
   * {@link org.apache.slide.taglib.bean.DomainBean DomainBean} scripting 
   * variable.
   * 
   * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
   * @version $Revision: 1.6 $
   */
  public abstract class SetDomainTagSupport
      extends TagSupport {
      
      
      // ----------------------------------------------------- Instance Variables
      
      
      /**
       * The bean that encapsulates the Slide domain.
       */
      protected DomainBean domain;
      
      
      /**
       * Name of the PageContext attribute under which the bean should be stored.
       */
      protected String attrName;
      
      
      /**
       * Scope where the PageContext should be stored.
       */
      private int scope;
      
      
      // ----------------------------------------------------------- Construction
      
      
      /**
       * Initialize inherited and local state.
       */
      public SetDomainTagSupport() {
          super();
          
          init();
      }
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when closing of this tag.
       *
       * @throws JspException never thrown
       */
      public int doEndTag()
          throws JspException {
          super.doEndTag();
          
          if (domain != null) {
              pageContext.setAttribute(attrName, domain, scope);
          }
          init();
          
          return EVAL_PAGE;
      }
      
      
      /**
       * Releases any resources we may have (or inherit).
       */
      public void release() {
          super.release();
          
          init();
      }
      
      
      // ------------------------------------------------------------- Properties
      
      
      /**
       * Sets the 'scope' attribute.
       * 
       * @param scope the attribute value
       */
      public void setScope(String scope) {
          
          this.scope = Scopes.valueOf(scope);
      }
      
      
      // -------------------------------------------------------- Private Methods
      
      
      /**
       * Reset internal state.
       */
      private void init() {
          
          domain = null;
          attrName = null;
      }
      
      
  }
  
  
  
  
  
  1.1                  jakarta-slide/src/taglib/common/org/apache/slide/taglib/tag/SetNamespaceTagSupport.java
  
  Index: SetNamespaceTagSupport.java
  ===================================================================
  /*
   * $Header$
   * $Revision$
   * $Date$
   *
   * ====================================================================
   *
   * 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", "Slide", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.slide.taglib.tag;
  
  import javax.servlet.ServletContext;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  
  import org.apache.slide.taglib.bean.DomainBean;
  import org.apache.slide.taglib.bean.NamespaceBean;
  import org.apache.slide.taglib.util.Scopes;
  
  /**
   * Abstract foundation for tags that expose a Slide namespace as a 
   * {@link org.apache.slide.taglib.bean.NamespaceBean NamespaceBean} scripting 
   * variable.
   *
   * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
   * @version $Revision: $
   */
  public class SetNamespaceTagSupport
      extends TagSupport {
      
      
      // ----------------------------------------------------- Instance Variables
      
      
      /**
       * The associated bean that represents the namespace chosen by the 
       * namespace tag, and that will optionally be put in the PageContext 
       * attributes.
       */
      protected NamespaceBean namespace;
      
      
      /**
       * Value of 'name' tag attribute, which specifies the name of the 
       * namespace to choose.
       */
      protected String name;
      
      
      /**
       * Name of the PageContext attribute under which the bean should be stored.
       */
      protected String attrName;
      
      
      /**
       * Scope where the PageContext should be stored.
       */
      private int scope;
      
      
      // ----------------------------------------------------------- Constructors 
      
      
  	/**
  	 * Constructor for SetNamespaceTagSupport.
  	 */
  	public SetNamespaceTagSupport() {
  		super();
          
          init();
  	}
      
      
      // ---------------------------------------------- TagSupport Implementation
      
      
      /**
       * Called by the JSP Engine when closing of this tag.
       *
       * @throws JspException Not thrown
       */
      public int doEndTag()
          throws JspException {
          
          if (namespace != null) {
              pageContext.setAttribute(attrName, namespace, scope);
          }
          init();
          
          return EVAL_PAGE;
      }
  
      
      /**
       * Releases any resources we may have (or inherit).
       */
      public void release() {
          super.release();
          
          init();
      }
      
      
      // ------------------------------------------------------------- Properties
      
      
      /**
       * Sets the 'name' attribute.
       *
       * @param name the attribute value
       */
      public void setName(String name) {
          
          this.name = name;
      }
      
      
      /**
       * Sets the 'scope' attribute.
       * 
       * @param scope the attribute value
       */
      public void setScope(String scope) {
          
          this.scope = Scopes.valueOf(scope);
      }
      
      
      // ------------------------------------------------------ Protected Methods
      
      
      /**
       * Convenience method to support subclasses in retrieving the chosen 
       * namespace, and wrapping it in a 
       * {@link org.apache.slide.taglib.bean.NamespaceBean NamespaceBean}.
       * 
       * @param domain the bean representing the domain
       * @param name the name of the namespace
       */
      protected NamespaceBean getNamespace(DomainBean domain, String name) {
          
          NamespaceBean bean = null;
          
          if (name == null) {
              // look for a 'namespace' context parameter, and use its value
              // as namespace name if present
              ServletContext context = pageContext.getServletContext();
              name = (String) context.getAttribute
                  ("org.apache.slide.NamespaceName");
          }
          if (name == null) {
              // look for a 'namespace' context parameter, and use its value
              // as namespace name if present
              ServletContext context = pageContext.getServletContext();
              name = context.getInitParameter
                  ("org.apache.slide.NamespaceName");
          }
          if (name == null) {
              // use the default namespace
              name = domain.getDefaultNamespaceName();
          }
          
          if (name != null) {
              bean = domain.getNamespace(name);
              setName(name);
          }
          
          return bean;
      }
      
      
      // -------------------------------------------------------- Private Methods
      
      
      /**
       * Reset internal state.
       */
      private void init() {
          
          name = null;
          attrName = null;
          scope = PageContext.PAGE_SCOPE;
      }
      
      
  }
  
  
  
  1.4       +49 -0     jakarta-slide/src/taglib/slide-jstl.tld
  
  Index: slide-jstl.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/taglib/slide-jstl.tld,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- slide-jstl.tld	1 Aug 2002 13:14:46 -0000	1.3
  +++ slide-jstl.tld	1 Aug 2002 14:42:57 -0000	1.4
  @@ -22,6 +22,28 @@
       <required>true</required>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
  +   <attribute>
  +    <name>scope</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +  </tag>
  +  
  +  <!-- The 'setDomain' Tag -->
  +  <tag>
  +   <name>setDomain</name>
  +   <tag-class>org.apache.slide.taglib.tag.jstl.SetDomainTag</tag-class>
  +   <body-content>JSP</body-content>
  +   <attribute>
  +    <name>var</name>
  +    <required>true</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>scope</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
     </tag>
     
     <!-- The 'namespace' Tag -->
  @@ -36,6 +58,33 @@
      </attribute>
      <attribute>
       <name>var</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>scope</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +  </tag>
  +  
  +  <!-- The 'setNamespace' Tag -->
  +  <tag>
  +   <name>setNamespace</name>
  +   <tag-class>org.apache.slide.taglib.tag.jstl.SetNamespaceTag</tag-class>
  +   <body-content>JSP</body-content>
  +   <attribute>
  +    <name>name</name>
  +    <required>false</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>var</name>
  +    <required>true</required>
  +    <rtexprvalue>false</rtexprvalue>
  +   </attribute>
  +   <attribute>
  +    <name>scope</name>
       <required>false</required>
       <rtexprvalue>false</rtexprvalue>
      </attribute>
  
  
  
  1.1                  jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/SetNamespaceTag.java
  
  Index: SetNamespaceTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/NamespaceTag.java,v 1.2 2002/03/28 06:12:05 jericho Exp $
   * $Revision: 1.2 $
   * $Date: 2002/03/28 06:12:05 $
   *
   * ====================================================================
   *
   * 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", "Slide", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag.jstl;
  
  import javax.servlet.jsp.JspException;
  
  import org.apache.slide.taglib.bean.DomainBean;
  import org.apache.slide.taglib.tag.SetNamespaceTagSupport;
  
  /**
   * Tag class for tags that store a Slide namespace in a scoped variable.
   * 
   * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
   * @version $Revision: 1.2 $
   */
  public class SetNamespaceTag
      extends SetNamespaceTagSupport {
      
      
      // ----------------------------------------------------------- Construction
      
      
      /**
       * Initialize inherited and local state.
       */
      public SetNamespaceTag() {
          super();
          
          init();
      }
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when opening this tag.
       *
       * @throws JspException not thrown
       */
      public int doStartTag()
          throws JspException {
          
          // evaluate the 'name' attribute
          String evalName = (String)
              JstlTagUtils.evaluateOptionalAttribute("namespace", "name", name, 
                                                     String.class, this,
                                                     pageContext);
          
          if (evalName != null) {
              // if the name attribute was set, look for a corresponding 
              // namespace
              DomainBean domain = JstlTagUtils.findDomain(this, pageContext);
              namespace = getNamespace(domain, evalName);
          } else {
              // use the default namespace, if available
              namespace = JstlTagUtils.findNamespace(this, pageContext);
          }
          
          return super.doStartTag();
      }
      
      
      /**
       * Releases any resources we may have (or inherit).
       */
      public void release() {
          super.release();
          
          init();
      }
      
      
      // ------------------------------------------------------------- Properties
      
      
      /**
       * Returns the 'var' attribute.
       *
       * @return value of the 'var' attribute
       */
      public String getVar() {
          
          return attrName;
      }
      
      
      /**
       * Sets the 'var' attribute.
       *
       * @param var the attribute value
       */
      public void setVar(String var) {
          
          attrName = var;
      }
      
      
      // -------------------------------------------------------- Private Methods
      
      
      /**
       * Reset internal state.
       */
      private void init() {
          
          // nothing to reset as of yet
      }
      
      
  }
  
  
  
  
  1.1                  jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/SetDomainTag.java
  
  Index: SetDomainTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-slide/src/taglib/jstl/org/apache/slide/taglib/tag/jstl/DomainTag.java,v 1.3 2002/04/25 21:12:33 jericho Exp $
   * $Revision: 1.3 $
   * $Date: 2002/04/25 21:12:33 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 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", "Slide", 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/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */ 
  
  package org.apache.slide.taglib.tag.jstl;
  
  import javax.servlet.jsp.JspException;
  
  import org.apache.slide.taglib.tag.SetDomainTagSupport;
  
  /**
   * Tag class that represents the Slide domain in a JSTL context. This class 
   * extends 
   * {@link org.apache.slide.taglib.tag.DomainTagSupport DomainTagSupport} only 
   * to provide a setter method for the attribute name the domain bean should be 
   * stored under, using the 'var' tag attribute.
   * 
   * @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
   * @version $Revision: 1.3 $
   */
  public class SetDomainTag
      extends SetDomainTagSupport {
      
      
      // ------------------------------------------------------------ Tag Methods
      
      
      /**
       * Called by the JSP Engine when opening this tag.
       *
       * @throws JspException not thrown
       */
      public int doStartTag()
          throws JspException {
          
          // this util method will create the DomainBean if we're not already
          // nested in another DomainTag
          domain = JstlTagUtils.findDomain(this, pageContext);
          
          return super.doStartTag();
      }
      
      
      // --------------------------------------------------------- Public Methods
      
      
      /**
       * Returns the 'var' attribute.
       *
       * @return value of the 'var' attribute
       */
      public String getVar() {
          
          return attrName;
      }
      
      
      /**
       * Sets the 'var' attribute.
       *
       * @param id the attribute value
       */
      public void setVar(String var) {
          
          attrName = var;
      }
      
      
  }
  
  
  
  

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