craigmcc    02/03/16 18:49:06

  Modified:    doc/userGuide struts-html.xml
               src/share/org/apache/struts/taglib/html LinkTag.java
  Added:       src/share/org/apache/struts/taglib/html FrameTag.java
  Log:
  Added a new <html:frame> tag that provides the same sort of manipulations to
  the "src" attribute that <html:link> does for the "href" attribute.
  
  PR: Bugzilla #6923
  Submitted by: Joe Germuska <joe at germuska.com>, who also
                  provided the implementation class
  
  Revision  Changes    Path
  1.6       +374 -0    jakarta-struts/doc/userGuide/struts-html.xml
  
  Index: struts-html.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/doc/userGuide/struts-html.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- struts-html.xml   17 Mar 2002 01:44:41 -0000      1.5
  +++ struts-html.xml   17 Mar 2002 02:49:06 -0000      1.6
  @@ -1499,6 +1499,380 @@
   
       <tag>
   
  +        <name>frame</name>
  +        <summary>Render an HTML frame element</summary>
  +        <tagclass>org.apache.struts.taglib.html.FrameTag</tagclass>
  +        <info>
  +
  +            <p>Renders an HTML <code>&lt;frame&gt;</code> element
  +            with processing for the <code>src</code> attribute that is
  +            identical to that performed by the <code>&lt;html:link&gt;</code>
  +            tag for the <code>href</code> attribute.  URL rewriting will be
  +            applied automatically, to maintain session state in the
  +            absence of cookies.</p>
  +
  +            <p>The base URL for this frame is calculated based on
  +            which of the following attributes you specify (you must
  +            specify exactly one of them):</p>
  +            <ul>
  +            <li><em>forward</em> - Use the value of this attribute as the
  +                name of a global <code>ActionForward</code> to be looked
  +                up, and use the application-relative or context-relative
  +                URI found there.</li>
  +            <li><em>href</em> - Use the value of this attribute unchanged.
  +                </li>
  +            <li><em>page</em> - Use the value of this attribute as a
  +                application-relative URI, and generate a server-relative
  +                URI by including the context path and application
  +                prefix.</li>
  +            </ul>
  +
  +            <p>Normally, the hyperlink you specify with one of the
  +            attributes described in the previous paragraph will be left
  +            unchanged (other than URL rewriting if necessary).  However,
  +            there are two ways you can append one or more dynamically
  +            defined query parameters to the hyperlink -- specify a single
  +            parameter with the <code>paramId</code> attribute (and its
  +            associated attributes to select the value), or specify the
  +            <code>name</code> (and optional <code>property</code>)
  +            attributes to select a <code>java.util.Map</code> bean that
  +            contains one or more parameter ids and corresponding values.
  +            </p>
  +
  +            <p>To specify a single parameter, use the <code>paramId</code>
  +            attribute to define the name of the request parameter to be
  +            submitted.  To specify the corresponding value, use one of the
  +            following approaches:</p>
  +            <ul>
  +            <li><em>Specify only the <code>paramName</code> attribute</em>
  +                - The named JSP bean (optionally scoped by the value of the
  +                <code>paramScope</code> attribute) must identify a value
  +                that can be converted to a String.</li>
  +            <li><em>Specify both the <code>paramName</code> and
  +                <code>paramProperty</code> attributes</em> - The specified
  +                property getter method will be called on the JSP bean
  +                identified by the <code>paramName</code> (and optional
  +                <code>paramScope</code>) attributes, in order to select
  +                a value that can be converted to a String.</li>
  +            </ul>
  +
  +            <p>If you prefer to specify a <code>java.util.Map</code> that
  +            contains all of the request parameters to be added to the
  +            hyperlink, use one of the following techniques:</p>
  +            <ul>
  +            <li><em>Specify only the <code>name</code> attribute</em> -
  +                The named JSP bean (optionally scoped by the value of
  +                the <code>scope</code> attribute) must identify a
  +                <code>java.util.Map</code> containing the parameters.</li>
  +            <li><em>Specify both <code>name</code> and
  +                <code>property</code> attributes</em> - The specified
  +                property getter method will be called on the bean
  +                identified by the <code>name</code> (and optional
  +                <code>scope</code>) attributes, in order to return the
  +                <code>java.util.Map</code> containing the parameters.</li>
  +            </ul>
  +
  +            <p>As the <code>Map</code> is processed, the keys are assumed
  +            to be the names of query parameters to be appended to the
  +            hyperlink.  The value associated with each key must be either
  +            a String or a String array representing the parameter value(s),
  +            or an object whose toString() method will be called.
  +            If a String array is specified, more than one value for the
  +            same query parameter name will be created.</p>
  +
  +            <p>Additionally, you can request that the current transaction
  +            control token, if any, be included in the generated hyperlink
  +            by setting the <code>transaction</code> attribute to
  +            <code>true</code>.
  +            You can also request that an anchor ("#xxx") be added to the
  +            end of the URL that is created by any of the above mechanisms,
  +            by using the <code>anchor</code> attribute.</p>
  +
  +        </info>
  +
  +        <attribute>
  +            <name>anchor</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>Optional anchor tag ("#xxx") to be added to the generated
  +                hyperlink.  Specify this value <strong>without</strong> any
  +                "#" character.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>forward</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>Logical name of a global <code>ActionForward</code> that
  +                contains the actual content-relative URI of the destination
  +                of this transfer.  This hyperlink may be dynamically
  +                modified by the inclusion of query parameters, as described
  +                in the tag description.  You <strong>must</strong> specify
  +                exactly one of the <code>forward</code> attribute, the
  +                <code>href</code> attribute,
  +                or the <code>page</code> attribute.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>frameborder</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>Should a frame border be generated around this frame (1)
  +                or not (0)?</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>frameName</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>Value for the <code>name</code> attribute of the rendered
  +                <code>&lt;frame&gt;</code> element.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>href</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The URL to which this hyperlink will transfer control
  +                if activated.  This hyperlink may be dynamically modified
  +                by the inclusion of query parameters, as described in the
  +                tag description.  You <strong>must</strong> specify
  +                exactly one of the <code>forward</code> attribute, the
  +                <code>href</code> attribute,
  +                or the <code>page</code> attribute.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>longdesc</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>URI of a long description of the frame.  This description
  +                should supplement the short description provided by the
  +                <code>title</code> attribute, and may be particularly useful
  +                for non-visual user agents.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>marginheight</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The amount of space (in pixels) to be left between the
  +                frame's contents and its top and bottom margins.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>marginwidth</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The amount of space (in pixels) to be left between the
  +                frame's contents and its left and right argins.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>name</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The name of a JSP bean that contains a <code>Map</code>
  +                representing the query parameters (if <code>property</code>
  +                is not specified), or a JSP bean whose property getter is
  +                called to return a <code>Map</code> (if <code>property</code>
  +                is specified).</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>noresize</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>Should users be disallowed from resizing the frame?
  +                (true, false).</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>page</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The applicaiton-relative path (beginning with a "/"
  +                character) to which this hyperlink will transfer control
  +                if activated.  This hyperlink may be dynamically modified
  +                by the inclusion of query parameters, as described in the
  +                tag description.  You <strong>must</strong> specify exactly
  +                one of the <code>forward</code> attribute, the
  +                <code>href</code> attribute,
  +                or the <code>page</code> attribute.</p>
  +                </info>
  +            </attribute>
  +
  +        <attribute>
  +            <name>paramId</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The name of the request parameter that will be dynamically
  +                added to the generated hyperlink.  The corresponding value is
  +                defined by the <code>paramName</code> and (optional)
  +                <code>paramProperty</code> attributes, optionally scoped by
  +                the <code>paramScope</code> attributel</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>paramName</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The name of a JSP bean that is a String containing the
  +                value for the request parameter named by <code>paramId</code>
  +                (if <code>paramProperty</code> is not specified), or a JSP
  +                bean whose property getter is called to return a String
  +                (if <code>paramProperty</code> is specified).  The JSP bean
  +                is constrained to the bean scope specified by the
  +                <code>paramScope</code> property, if it is specified.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>paramProperty</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The name of a property of the bean specified by the
  +                <code>paramName</code> attribute, whose return value must
  +                be a String containing the value of the request parameter
  +                (named by the <code>paramId</code> attribute) that will be
  +                dynamically added to this hyperlink.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>paramScope</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The scope within which to search for the bean specified
  +                by the <code>paramName</code> attribute.  If not specified,
  +                all scopes are searched.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>property</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The name of a property of the bean specified by the
  +                <code>name</code> attribute, whose return value must be
  +                a <code>java.util.Map</code> containing the query parameters
  +                to be added to the hyperlink.  You <strong>must</strong>
  +                specify the <code>name</code> attribute if you specify
  +                this attribute.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>scope</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The scope within which to search for the bean specified
  +                by the <code>name</code> attribute.  If not specified, all
  +                scopes are searched.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>scrolling</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>Should scroll bars be created unconditionally (yes),
  +                never (no), or only when needed (auto)?</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>style</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>CSS styles to be applied to this element.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>styleClass</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>CSS stylesheet class to be applied to this element.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>styleId</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                Identifier to be assigned to this HTML element.
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>title</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The advisory title for this element.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>titleKey</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>The message resources key for the advisory title
  +                for this element.</p>
  +            </info>
  +        </attribute>
  +
  +        <attribute>
  +            <name>transaction</name>
  +            <required>false</required>
  +            <rtexprvalue>true</rtexprvalue>
  +            <info>
  +                <p>If set to <code>true</code>, any current transaction
  +                control token will be included in the generated hyperlink,
  +                so that it will pass an <code>isTokenValid()</code> test
  +                in the receiving Action.</p>
  +            </info>
  +        </attribute>
  +
  +    </tag>
  +
  +
  +    <tag>
  +
           <name>hidden</name>
           <summary>
               Render A Hidden Field
  
  
  
  1.22      +61 -43    
jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java
  
  Index: LinkTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- LinkTag.java      13 Jan 2002 00:25:37 -0000      1.21
  +++ LinkTag.java      17 Mar 2002 02:49:06 -0000      1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java,v 1.21 
2002/01/13 00:25:37 craigmcc Exp $
  - * $Revision: 1.21 $
  - * $Date: 2002/01/13 00:25:37 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/LinkTag.java,v 1.22 
2002/03/17 02:49:06 craigmcc Exp $
  + * $Revision: 1.22 $
  + * $Date: 2002/03/17 02:49:06 $
    *
    * ====================================================================
    *
  @@ -89,7 +89,7 @@
    * Generate a URL-encoded hyperlink to the specified URI.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.21 $ $Date: 2002/01/13 00:25:37 $
  + * @version $Revision: 1.22 $ $Date: 2002/03/17 02:49:06 $
    */
   
   public class LinkTag extends BaseHandlerTag {
  @@ -343,47 +343,9 @@
               return (EVAL_BODY_TAG);
           }
   
  -        // Generate the hyperlink URL
  -        Map params = RequestUtils.computeParameters
  -            (pageContext, paramId, paramName, paramProperty, paramScope,
  -             name, property, scope, transaction);
  -
  -        // if "indexed=true", add "index=x" parameter to query string
  -        // since 1.1
  -        if( indexed ) {
  -           // look for outer iterate tag
  -           IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, 
IterateTag.class);
  -           if (iterateTag == null) {
  -              // this tag should only be nested in iteratetag, if it's not, throw 
exception
  -              JspException e = new 
JspException(messages.getMessage("indexed.noEnclosingIterate"));
  -              RequestUtils.saveException(pageContext, e);
  -              throw e;
  -           }
  -
  -           //calculate index, and add as a parameter
  -           if (params == null) {
  -               params = new HashMap();             //create new HashMap if no other 
params
  -           }
  -           if (indexId != null) {
  -            params.put(indexId, Integer.toString(iterateTag.getIndex()));
  -           } else {
  -              params.put("index", Integer.toString(iterateTag.getIndex()));
  -           }
  -        }
  -
  -        String url = null;
  -        try {
  -            url = RequestUtils.computeURL(pageContext, forward, href,
  -                                          page, params, anchor, false);
  -        } catch (MalformedURLException e) {
  -            RequestUtils.saveException(pageContext, e);
  -            throw new JspException
  -                (messages.getMessage("rewrite.url", e.toString()));
  -        }
  -
           // Generate the opening anchor element
           StringBuffer results = new StringBuffer("<a href=\"");
  -        results.append(url);
  +        results.append(calculateURL());
           results.append("\"");
           if (target != null) {
               results.append(" target=\"");
  @@ -465,6 +427,62 @@
           target = null;
           text = null;
           transaction = false;
  +
  +    }
  +
  +
  +    // ------------------------------------------------------ Protected Methods
  +
  +
  +    /**
  +     * Return the complete URL to which this hyperlink will direct the user.
  +     *
  +     * @exception JspException if an exception is thrown calculating the value
  +     */
  +    protected String calculateURL() throws JspException {
  +
  +        // Identify the parameters we will add to the completed URL
  +        Map params = RequestUtils.computeParameters
  +            (pageContext, paramId, paramName, paramProperty, paramScope,
  +             name, property, scope, transaction);
  +
  +        // if "indexed=true", add "index=x" parameter to query string
  +        // since 1.1
  +        if( indexed ) {
  +
  +           // look for outer iterate tag
  +           IterateTag iterateTag =
  +               (IterateTag) findAncestorWithClass(this, IterateTag.class);
  +           if (iterateTag == null) {
  +               // This tag should only be nested in an iterate tag
  +               // If it's not, throw exception
  +               JspException e = new JspException
  +                   (messages.getMessage("indexed.noEnclosingIterate"));
  +               RequestUtils.saveException(pageContext, e);
  +               throw e;
  +           }
  +
  +           //calculate index, and add as a parameter
  +           if (params == null) {
  +               params = new HashMap();             //create new HashMap if no other 
params
  +           }
  +           if (indexId != null) {
  +            params.put(indexId, Integer.toString(iterateTag.getIndex()));
  +           } else {
  +              params.put("index", Integer.toString(iterateTag.getIndex()));
  +           }
  +        }
  +
  +        String url = null;
  +        try {
  +            url = RequestUtils.computeURL(pageContext, forward, href,
  +                                          page, params, anchor, false);
  +        } catch (MalformedURLException e) {
  +            RequestUtils.saveException(pageContext, e);
  +            throw new JspException
  +                (messages.getMessage("rewrite.url", e.toString()));
  +        }
  +        return (url);
   
       }
   
  
  
  
  1.1                  
jakarta-struts/src/share/org/apache/struts/taglib/html/FrameTag.java
  
  Index: FrameTag.java
  ===================================================================
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FrameTag.java,v 1.1 
2002/03/17 02:49:06 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/03/17 02:49:06 $
   *
   * ====================================================================
   * 
   * 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", "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 [EMAIL PROTECTED]
   *
   * 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.struts.taglib.html;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLEncoder;
  import java.util.Iterator;
  import java.util.Map;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  import org.apache.struts.action.Action;
  import org.apache.struts.action.ActionForward;
  import org.apache.struts.action.ActionForwards;
  import org.apache.struts.util.MessageResources;
  import org.apache.struts.util.RequestUtils;
  import org.apache.struts.util.ResponseUtils;
  
  
  /**
   * Generate an HTML <code>&lt;frame&gt;</code> tag with similar capabilities
   * as those the <code>&lt;html:link&gt;</code> tag provides for hyperlink
   * elements.  The <code>src</code> element is rendered using the same technique
   * that {@link LinkTag} uses to render the <code>href</code> attribute of a
   * hyperlink.  Additionall, the HTML 4.0
   * frame tag attributes <code>noresize</code>, <code>scrolling</code>,
   * <code>marginheight</code>, <code>marginwidth</code>,
   * <code>frameborder</code>, and <code>longdesc</code> are supported.
   * The frame
   * <code>name</code> attribute is rendered based on the <code>frameName</code>
   * property.
   *
   * Note that the value of <code>longdesc</code> is intended to be a URI, but
   * currently no rewriting is supported.  The attribute is set directly from
   * the property value.
   *
   * @author Joe Germuska
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/03/17 02:49:06 $
   * @since 1.1
   */
  
  public class FrameTag extends LinkTag {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The frameborder attribute that should be rendered (1, 0).
       */
      protected String frameborder = null;
  
      public String getFrameborder() {
          return (this.frameborder);
      }
  
      public void setFrameborder(String frameborder) {
          this.frameborder = frameborder;
      }
  
  
      /**
       * The <code>name</code> attribute that should be rendered for this frame.
       */
      protected String frameName = null;
  
      public String getFrameName() {
          return (this.frameName);
      }
  
      public void setFrameName(String frameName) {
          this.frameName = frameName;
      }
  
  
      /**
       * URI of a long description of this frame (complements title).
       */
      protected String longdesc = null;
  
      public String getLongdesc() {
          return (this.longdesc);
      }
  
      public void setLongdesc(String longdesc) {
          this.longdesc = longdesc;
      }
  
  
      /**
       * The margin height in pixels, or zero for no setting.
       */
      protected int marginheight = 0;
  
      public int getMarginheight() {
          return (this.marginheight);
      }
  
      public void setMarginheight(int marginheight) {
          this.marginheight = marginheight;
      }
  
  
      /**
       * The margin width in pixels, or zero for no setting.
       */
      protected int marginwidth = 0;
  
      public int getMarginwidth() {
          return (this.marginwidth);
      }
  
      public void setMarginwidth(int marginwidth) {
          this.marginwidth = marginwidth;
      }
  
  
      /**
       * Should users be disallowed to resize the frame?
       */
      protected boolean noresize = false;
  
      public boolean getNoresize() {
          return (this.noresize);
      }
  
      public void setNoresize(boolean noresize) {
          this.noresize = noresize;
      }
  
  
      /**
       * What type of scrolling should be supported (yes, no, auto)?
       */
      protected String scrolling = null;
  
      public String getScrolling() {
          return (this.scrolling);
      }
  
      public void setScrolling(String scrolling) {
          this.scrolling = scrolling;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Render the appropriately encoded URI.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
        // Print this element to our output writer
          StringBuffer results = new StringBuffer("<frame ");
          results.append("src=\"");
          results.append(calculateURL());
          results.append("\"");
          if (frameName != null) {
              results.append(" name=\"");
              results.append(frameName);
              results.append("\"");
          }
          if (noresize) {
              results.append(" noresize=\"noresize\"");
          }
          if (scrolling != null) {
              results.append(" scrolling=\"");
              results.append(scrolling);
              results.append("\"");
          }
          if (marginheight > 0) {
              results.append(" marginheight=\"");
              results.append(marginheight);
              results.append("\"");
          }
          if (marginwidth > 0) {
              results.append(" marginwidth=\"");
              results.append(marginwidth);
              results.append("\"");
          }
          if (frameborder != null) {
              results.append(" frameborder=\"");
              results.append(frameborder);
              results.append("\"");
          }
          if (longdesc != null) {
              results.append(" longdesc=\"");
              results.append(frameborder);
              results.append("\"");
          }
          results.append(prepareStyles());
          results.append(">");
          ResponseUtils.write(pageContext,results.toString());
  
        // Skip the body of this tag
        return (SKIP_BODY);
  
      }
  
  
      /**
       * Ignore the end of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
          return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
          super.release();
          frameborder = null;
          frameName = null;
          longdesc = null;
          marginheight = 0;
          marginwidth = 0;
          noresize = false;
          scrolling = null;
  
      }
  
  
  }
  
  
  

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

Reply via email to