struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/form BaseFieldTag.java BaseHandlerTag.java BaseInputTag.java ButtonTag.java CancelTag.java CheckboxTag.java FileTag.java FormTag.java HiddenTag.java MultiboxTag.java OptionTag.java OptionsTag.java PasswordTag.java RadioTag.java ResetTag.java SelectTag.java SubmitTag.java TextTag.java TextareaTag.java
Date Fri, 03 Nov 2000 18:45:03 GMT
craigmcc    00/11/03 10:45:01

  Added:       src/share/org/apache/struts/taglib/form BaseFieldTag.java
                        BaseHandlerTag.java BaseInputTag.java
                        ButtonTag.java CancelTag.java CheckboxTag.java
                        FileTag.java FormTag.java HiddenTag.java
                        MultiboxTag.java OptionTag.java OptionsTag.java
                        PasswordTag.java RadioTag.java ResetTag.java
                        SelectTag.java SubmitTag.java TextTag.java
                        TextareaTag.java
  Log:
  Initial check-in of the new form tag library for Struts 1.0, converted
  from the original by Michael Schachter.
  
  Relative to the original tags in the "struts.tld" library, the following
  changes have been made:
  - Migrated to a new tag library whose TLD file is "struts-form.tld"
  - In the tags that have event handler attributes, the attribute names
    are now all lower case (i.e. onClick --> onclick) for consistency
    with XHTML.
  - Removed "options1" tag because JDK 1.1 compatibility is no longer
    required.
  
  Thanks Michael!
  
  Revision  Changes    Path
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/BaseFieldTag.java
  
  Index: BaseFieldTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/BaseFieldTag.java,v 1.1 2000/11/03 18:44:57 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:57 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  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.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Convenience base class for the various input tags for text fields.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:57 $
   */
  
  public abstract class BaseFieldTag extends BaseInputTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * Comma-delimited list of content types that a server processing this form
       * will handle correctly.  This property is defined only for the
       * <code>file</code> tag, but is implemented here because it affects the
       * rendered HTML of the corresponding &lt;input&gt; tag.
       */
      protected String accept = null;
  
      public String getAccept() {
  	return (this.accept);
      }
  
      public void setAccept(String accept) {
  	this.accept = accept;
      }
  
  
      /**
       * The name of the bean containing our underlying property.
       */
      protected String name = Constants.BEAN_KEY;
  
      public String getName() {
  	return (this.name);
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      /**
       * The type of input field represented by this tag (text, password, or
       * hidden).
       */
      protected String type = null;
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Generate the required input tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Create an appropriate "input" element based on our parameters
  	StringBuffer results = new StringBuffer("<input type=\"");
  	results.append(type);
  	results.append("\" name=\"");
  	results.append(property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (accept != null) {
  	    results.append(" accept=\"");
  	    results.append(accept);
  	    results.append("\"");
  	}
  	if (maxlength != null) {
  	    results.append(" maxlength=\"");
  	    results.append(maxlength);
  	    results.append("\"");
  	}
  	if (cols != null) {
  	    results.append(" size=\"");
  	    results.append(cols);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	results.append(" value=\"");
  	if (value != null) {
  	    results.append(BeanUtils.filter(value));
  	} else {
  	    Object bean = pageContext.findAttribute(name);
  	    if (bean == null)
  		throw new JspException
  		    (messages.getMessage("getter.bean", name));
  	    try {
  		String value = BeanUtils.getScalarProperty(bean, property);
  		if (value == null)
  		    value = "";
  		results.append(BeanUtils.filter(value));
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	    } catch (NoSuchMethodException e) {
  		throw new JspException
  		    (messages.getMessage("getter.method", property, name));
  	    }
  	}
  	results.append("\"");
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_BODY_TAG);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	accept = null;
  	name = Constants.BEAN_KEY;
  	type = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/BaseHandlerTag.java
  
  Index: BaseHandlerTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/BaseHandlerTag.java,v 1.1 2000/11/03 18:44:57 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:57 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  import javax.servlet.jsp.tagext.BodyTagSupport;
  import org.apache.struts.util.MessageResources;
  
  /**
   * Base class for tags that render form elements capable of including JavaScript
   * event handlers and/or CSS Style attributes. This class does not implement
   * the doStartTag() or doEndTag() methods. Subclasses should provide
   * appropriate implementations of these.
   *
   * @author Don Clasen
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:57 $
   */
  
  public abstract class BaseHandlerTag extends BodyTagSupport {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
  //  Navigation Management
  
      /** Access key character. */
      protected String accesskey= null;
  
      /** Tab index value. */
      protected String tabindex = null;
  
  //  Mouse Events
  
      /** Mouse click event. */
      private String onclick = null;
  
      /** Mouse double click event. */
      private String ondblclick = null;
  
      /** Mouse over component event. */
      private String onmouseover = null;
  
      /** Mouse exit component event. */
      private String onmouseout = null;
  
      /** Mouse moved over component event. */
      private String onmousemove = null;
  
      /** Mouse pressed on component event. */
      private String onmousedown = null;
  
      /** Mouse released on component event. */
      private String onmouseup = null;
  
  //  Keyboard Events
  
      /** Key down in component event. */
      private String onkeydown = null;
  
      /** Key released in component event. */
      private String onkeyup = null;
  
      /** Key down and up together in component event. */
      private String onkeypress = null;
  
  // Text Events
  
      /** Text selected in component event. */
      private String onselect = null;
  
      /** Content changed after component lost focus event. */
      private String onchange = null;
  
  // Focus Events
  
      /** Component lost focus event. */
      private String onblur = null;
  
      /** Component has received focus event. */
      private String onfocus = null;
  
  // CSS Style Support
  
      /** Style attribute associated with component. */
      private String style = null;
  
      /** Named Style class associated with component. */
      private String styleClass = null;
  
      // ------------------------------------------------------------- Properties
  
  //  Navigation Management
  
      /** Sets the accessKey character. */
      public void setAccesskey(String accessKey) {
  	this.accesskey = accessKey;
      }
  
      /** Returns the accessKey character. */
      public String getAccesskey() {
  	return (this.accesskey);
      }
  
  
      /** Sets the tabIndex value. */
      public void setTabindex(String tabIndex) {
  	this.tabindex = tabIndex;
      }
  
      /** Returns the tabIndex value. */
      public String getTabindex() {
  	return (this.tabindex);
      }
  
  // Mouse Events
  
      /** Sets the onClick event handler. */
      public void setOnclick(String onClick) {
          this.onclick = onClick;
      }
  
      /** Returns the onClick event handler. */
      public String getOnclick() {
          return onclick;
      }
  
      /** Sets the onDblClick event handler. */
      public void setOndblclick(String onDblClick) {
          this.ondblclick = onDblClick;
      }
  
      /** Returns the onDblClick event handler. */
      public String getOndblclick() {
          return ondblclick;
      }
  
      /** Sets the onMouseDown event handler. */
      public void setOnmousedown(String onMouseDown) {
          this.onmousedown = onMouseDown;
      }
  
      /** Returns the onMouseDown event handler. */
      public String getOnmousedown() {
          return onmousedown;
      }
  
      /** Sets the onMouseUp event handler. */
      public void setOnmouseup(String onMouseUp) {
          this.onmouseup = onMouseUp;
      }
  
      /** Returns the onMouseUp event handler. */
      public String getOnmouseup() {
          return onmouseup;
      }
  
      /** Sets the onMouseMove event handler. */
      public void setOnmousemove(String onMouseMove) {
          this.onmousemove = onMouseMove;
      }
  
      /** Returns the onMouseMove event handler. */
      public String getOnmousemove() {
          return onmousemove;
      }
  
      /** Sets the onMouseOver event handler. */
      public void setOnmouseover(String onMouseOver) {
          this.onmouseover = onMouseOver;
      }
  
      /** Returns the onMouseOver event handler. */
      public String getOnmouseover() {
          return onmouseover;
      }
  
      /** Sets the onMouseOut event handler. */
      public void setOnmouseout(String onMouseOut) {
          this.onmouseout = onMouseOut;
      }
  
      /** Returns the onMouseOut event handler. */
      public String getOnmouseout() {
          return onmouseout;
      }
  
  // Keyboard Events
  
      /** Sets the onKeyDown event handler. */
      public void setOnkeydown(String onKeyDown) {
          this.onkeydown = onKeyDown;
      }
  
      /** Returns the onKeyDown event handler. */
      public String getOnkeydown() {
          return onkeydown;
      }
  
      /** Sets the onKeyUp event handler. */
      public void setOnkeup(String onKeyUp) {
          this.onkeyup = onKeyUp;
      }
  
      /** Returns the onKeyUp event handler. */
      public String getOnkeyup() {
          return onkeyup;
      }
  
      /** Sets the onKeyPress event handler. */
      public void setOnkeypress(String onKeyPress) {
          this.onkeypress = onKeyPress;
      }
  
      /** Returns the onKeyPress event handler. */
      public String getOnkeypress() {
          return onkeypress;
      }
  
  // Text Events
  
      /** Sets the onChange event handler. */
      public void setOnchange(String onChange) {
          this.onchange = onChange;
      }
  
      /** Returns the onChange event handler. */
      public String getOnChange() {
          return onchange;
      }
  
      /** Sets the onSelect event handler. */
      public void setOnselect(String onSelect) {
          this.onselect = onSelect;
      }
  
      /** Returns the onSelect event handler. */
      public String getOnselect() {
          return onselect;
      }
  
  // Focus Events
  
      /** Sets the onBlur event handler. */
      public void setOnblur(String onBlur) {
          this.onblur = onBlur;
      }
  
      /** Returns the onBlur event handler. */
      public String getOnblur() {
          return onblur;
      }
  
      /** Sets the onFocus event handler. */
      public void setOnfocus(String onFocus) {
          this.onfocus = onFocus;
      }
  
      /** Returns the onFocus event handler. */
      public String getOnfocus() {
          return onfocus;
      }
  
  // CSS Style Support
  
      /** Sets the style attribute. */
      public void setStyle(String style) {
          this.style = style;
      }
  
      /** Returns the style attribute. */
      public String getStyle() {
          return style;
      }
  
      /** Sets the style class attribute. */
      public void setStyleClass(String styleClass) {
          this.styleClass = styleClass;
      }
  
      /** Returns the style class attribute. */
      public String getStyleClass() {
          return styleClass;
      }
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	accesskey = null;
  	tabindex = null;
  	onclick = null;
  	ondblclick = null;
  	onmouseover = null;
  	onmouseout = null;
  	onmousemove = null;
  	onmousedown = null;
  	onmouseup = null;
  	onkeydown = null;
  	onkeyup = null;
  	onkeypress = null;
  	onselect = null;
  	onchange = null;
  	onblur = null;
  	onfocus = null;
  	style = null;
  	styleClass = null;
  
      }
  
  
      // ------------------------------------------------------ Protected Methods
  
  
      /**
       * Prepares the style attributes for inclusion in the component's HTML tag.
       * @return The prepared String for inclusion in the HTML tag.
       */
      protected String prepareStyles() {
          StringBuffer styles = new StringBuffer();
          if (style != null) {
              styles.append(" style=\"");
              styles.append(style);
              styles.append("\"");
          }
          if (styleClass != null) {
              styles.append(" class=\"");
              styles.append(styleClass);
              styles.append("\"");
          }
          return styles.toString();
      }
  
      /**
       * Prepares the event handlers for inclusion in the component's HTML tag.
       * @return The prepared String for inclusion in the HTML tag.
       */
      protected String prepareEventHandlers() {
          StringBuffer handlers = new StringBuffer();
          prepareMouseEvents(handlers);
          prepareKeyEvents(handlers);
          prepareTextEvents(handlers);
          prepareFocusEvents(handlers);
          return handlers.toString();
      }
  
  
      // -------------------------------------------------------- Private Methods
  
  
      /**
       * Prepares the mouse event handlers, appending them to the the given
       * StringBuffer.
       * @param handlers The StringBuffer that output will be appended to.
       */
      private void prepareMouseEvents(StringBuffer handlers) {
          if (onclick != null) {
              handlers.append(" onclick=\"");
              handlers.append(onclick);
              handlers.append("\"");
          }
  
          if (ondblclick != null) {
              handlers.append(" ondblclick=\"");
              handlers.append(ondblclick);
              handlers.append("\"");
          }
  
          if (onmouseover != null) {
              handlers.append(" onmouseover=\"");
              handlers.append(onmouseover);
              handlers.append("\"");
          }
  
          if (onmouseout != null) {
              handlers.append(" onmouseout=\"");
              handlers.append(onmouseout);
              handlers.append("\"");
          }
  
          if (onmousemove != null) {
              handlers.append(" onmousemove=\"");
              handlers.append(onmousemove);
              handlers.append("\"");
          }
  
          if (onmousedown != null) {
              handlers.append(" onmousedown=\"");
              handlers.append(onmousedown);
              handlers.append("\"");
          }
  
          if (onmouseup != null) {
              handlers.append(" onmouseup=\"");
              handlers.append(onmouseup);
              handlers.append("\"");
          }
      }
  
      /**
       * Prepares the keyboard event handlers, appending them to the the given
       * StringBuffer.
       * @param handlers The StringBuffer that output will be appended to.
       */
      private void prepareKeyEvents(StringBuffer handlers) {
  
          if (onkeydown != null) {
              handlers.append(" onkeydown=\"");
              handlers.append(onkeydown);
              handlers.append("\"");
          }
  
          if (onkeyup != null) {
              handlers.append(" onkeyup=\"");
              handlers.append(onkeyup);
              handlers.append("\"");
          }
  
          if (onkeypress != null) {
              handlers.append(" onkeypress=\"");
              handlers.append(onkeypress);
              handlers.append("\"");
          }
      }
  
      /**
       * Prepares the text event handlers, appending them to the the given
       * StringBuffer.
       * @param handlers The StringBuffer that output will be appended to.
       */
      private void prepareTextEvents(StringBuffer handlers) {
  
          if (onselect != null) {
              handlers.append(" onselect=\"");
              handlers.append(onselect);
              handlers.append("\"");
          }
  
          if (onchange != null) {
              handlers.append(" onchange=\"");
              handlers.append(onchange);
              handlers.append("\"");
          }
      }
  
      /**
       * Prepares the focus event handlers, appending them to the the given
       * StringBuffer.
       * @param handlers The StringBuffer that output will be appended to.
       */
      private void prepareFocusEvents(StringBuffer handlers) {
  
          if (onblur != null) {
              handlers.append(" onblur=\"");
              handlers.append(onblur);
              handlers.append("\"");
          }
  
          if (onfocus != null) {
              handlers.append(" onfocus=\"");
              handlers.append(onfocus);
              handlers.append("\"");
          }
      }
  
  
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/BaseInputTag.java
  
  Index: BaseInputTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/BaseInputTag.java,v 1.1 2000/11/03 18:44:57 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:57 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.tagext.TagSupport;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Abstract base class for the various input tags.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:57 $
   */
  
  public abstract class BaseInputTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The number of character columns for this field, or negative
       * for no limit.
       */
      protected String cols = null;
  
  
      /**
       * The maximum number of characters allowed, or negative for no limit.
       */
      protected String maxlength = null;
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The name of the field (and associated property) being processed.
       */
      protected String property = null;
  
  
      /**
       * The number of rows for this field, or negative for no limit.
       */
      protected String rows = null;
  
  
      /**
       * The value for this field, or <code>null</code> to retrieve the
       * corresponding property from our associated bean.
       */
      protected String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the number of columns for this field.
       */
      public String getCols() {
  
  	return (this.cols);
  
      }
  
  
      /**
       * Set the number of columns for this field.
       *
       * @param cols The new number of columns
       */
      public void setCols(String cols) {
  
  	this.cols = cols;
  
      }
  
  
      /**
       * Return the maximum length allowed.
       */
      public String getMaxlength() {
  
  	return (this.maxlength);
  
      }
  
  
      /**
       * Set the maximum length allowed.
       *
       * @param maxlength The new maximum length
       */
      public void setMaxlength(String maxlength) {
  
  	this.maxlength = maxlength;
  
      }
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
  
  	return (this.property);
  
      }
  
  
      /**
       * Set the property name.
       *
       * @param property The new property name
       */
      public void setProperty(String property) {
  
  	this.property = property;
  
      }
  
  
      /**
       * Return the number of rows for this field.
       */
      public String getRows() {
  
  	return (this.rows);
  
      }
  
  
      /**
       * Set the number of rows for this field.
       *
       * @param rows The new number of rows
       */
      public void setRows(String rows) {
  
  	this.rows = rows;
  
      }
  
  
      /**
       * Return the size of this field (synonym for <code>getCols()</code>).
       */
      public String getSize() {
  
  	return (getCols());
  
      }
  
  
      /**
       * Set the size of this field (synonym for <code>setCols()</code>).
       *
       * @param size The new size
       */
      public void setSize(String size) {
  
  	setCols(size);
  
      }
  
  
      /**
       * Return the field value (if any).
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the field value (if any).
       *
       * @param value The new field value, or <code>null</code> to retrieve the
       *  corresponding property from the bean
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the start of this tag.  The default implementation does nothing.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Process the end of this tag.  The default implementation does nothing.
       *
       * @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();
  	cols = null;
  	maxlength = null;
  	property = null;
  	rows = null;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/ButtonTag.java
  
  Index: ButtonTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/ButtonTag.java,v 1.1 2000/11/03 18:44:58 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:58 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.util.BeanUtils;
  
  
  /**
   * Renders an HTML BUTTON tag within the Struts framework.
   *
   * @author Don Clasen
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:58 $
   */
  
  public final class ButtonTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
      /**
       * The property name of the generated button.
       */
      private String property = null;
  
  
      /**
       * The value of the button label.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
          return (property);
      }
  
      /**
       * Set the property name.
       *
       * @param name The property name
       */
      public void setProperty(String property) {
          this.property = property;
      }
  
  
      /**
       * Return the label value.
       */
      public String getValue() {
          return (value);
      }
  
  
      /**
       * Set the label value.
       * @param value The label value
       */
      public void setValue(String value) {
          this.value = value;
      }
  
      // --------------------------------------------------------- Public Methods
  
      /**
       * Process the start of this tag.
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
          // Do nothing until doEndTag() is called
          return (EVAL_BODY_TAG);
      }
      
      /**
       * Process the end of this tag.
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
          // Acquire the label value we will be generating
          String label = value;
          if ((label == null) && (bodyContent != null))
              label = bodyContent.getString().trim();
          if ((label == null) || (label.trim().length() < 1))
              label = "Click";
  
          // Generate an HTML element
          StringBuffer results = new StringBuffer();
          results.append("<input type=\"button\"");
          if (property != null) {
              results.append(" name=\"");
              results.append(property);
              results.append("\"");
          }
          if (accesskey != null) {
              results.append(" accesskey=\"");
              results.append(accesskey);
              results.append("\"");
          }
          if (tabindex != null) {
              results.append(" tabindex=\"");
              results.append(tabindex);
              results.append("\"");
          }
          results.append(" value=\"");
          results.append(label);
          results.append("\"");
          results.append(prepareEventHandlers());
          results.append(prepareStyles());
          results.append(">");
  
          // Render this element to our writer
          JspWriter writer = pageContext.getOut();
          try {
              writer.print(results.toString());
          }
          catch (IOException e) {
              throw new JspException
              (messages.getMessage("common.io", e.toString()));
          }
          
          return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	property = null;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/CancelTag.java
  
  Index: CancelTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/CancelTag.java,v 1.1 2000/11/03 18:44:58 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:58 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for input fields of type "cancel".
   *
   * @author Jeff Hutchinson
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:58 $
   */
  
  public final class CancelTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
      /**
       * The message resources for this package.
       */
      private static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The property name of the generated button.
       */
      private String property = Constants.CANCEL_PROPERTY;
  
  
      /**
       * The value of the button label.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
          return (property);
      }
  
      /**
       * Set the property name.
       *
       * @param name The property name
       */
      public void setProperty(String property) {
          this.property = property;
      }
  
  
      /**
       * Return the label value.
       */
      public String getValue() {
          return (value);
      }
  
  
      /**
       * Set the label value.
       * @param value The label value
       */
      public void setValue(String value) {
          this.value = value;
      }
  
      // --------------------------------------------------------- Public Methods
  
      /**
       * Process the start of this tag.
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
          // Do nothing until doEndTag() is called
          return (EVAL_BODY_TAG);
      }
  
      /**
       * Process the end of this tag.
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
      // Acquire the label value we will be generating
      String label = value;
      if ((label == null) && (bodyContent != null))
          label = bodyContent.getString().trim();
      if ((label == null) || (label.trim().length() < 1))
          label = "Cancel";
  
      // Generate an HTML element
      StringBuffer results = new StringBuffer();
      results.append("<input type=\"submit\"");
      results.append(" name=\"");
      results.append(property);
      results.append("\"");
      if (accesskey != null) {
  	results.append(" accesskey=\"");
  	results.append(accesskey);
  	results.append("\"");
      }
      if (tabindex != null) {
  	results.append(" tabindex=\"");
  	results.append(tabindex);
  	results.append("\"");
      }
      results.append(" value=\"");
      results.append(label);
      results.append("\"");
      results.append(prepareEventHandlers());
      results.append(prepareStyles());
      results.append(">");
  
      // Render this element to our writer
      JspWriter writer = pageContext.getOut();
      try {
          writer.print(results.toString());
      }
      catch (IOException e) {
          throw new JspException
          (messages.getMessage("common.io", e.toString()));
      }
  
      return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	property = Constants.CANCEL_PROPERTY;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/CheckboxTag.java
  
  Index: CheckboxTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/CheckboxTag.java,v 1.1 2000/11/03 18:44:58 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:58 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for input fields of type "checkbox".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:58 $
   */
  
  public final class CheckboxTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The name of the bean containing our underlying property.
       */
      private String name = Constants.BEAN_KEY;
  
      public String getName() {
  	return (this.name);
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      /**
       * The property name for this field.
       */
      private String property = null;
  
  
      /**
       * The server value for this option.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
  
  	return (this.property);
  
      }
  
  
      /**
       * Set the property name.
       *
       * @param property The new property name
       */
      public void setProperty(String property) {
  
  	this.property = property;
  
      }
  
  
      /**
       * Return the server value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the server value.
       *
       * @param value The new server value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Generate the required input tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Create an appropriate "input" element based on our parameters
  	StringBuffer results = new StringBuffer("<input type=\"checkbox\"");
  	results.append(" name=\"");
  	results.append(this.property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	String value = this.value;
  	if (value == null) {
  	    Object bean = pageContext.findAttribute(name);
  	    if (bean == null)
  		throw new JspException
  		    (messages.getMessage("getter.bean", name));
  	    try {
  		value = BeanUtils.getScalarProperty(bean, property);
  		if (value == null)
  		    value = "";
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	    } catch (NoSuchMethodException e) {
  		throw new JspException
  		    (messages.getMessage("getter.method", property, name));
  	    }
  	}
  	if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes")
  	    || value.equalsIgnoreCase("on"))
  	    results.append(" checked");
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Optionally render the associated label from the body content.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	if (bodyContent == null)
  	    return (EVAL_PAGE);
  
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.println(bodyContent.getString().trim());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue evaluating this page
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	name = Constants.BEAN_KEY;
  	property = null;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/FileTag.java
  
  Index: FileTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/FileTag.java,v 1.1 2000/11/03 18:44:58 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:58 $
   *
   * ====================================================================
   * 
   * 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.struts.taglib.form;
  
  
  /**
   * Custom tag for input fields of type "file".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:58 $
   */
  
  public final class FileTag extends BaseFieldTag {
  
  
      /**
       * Construct a new instance of this tag.
       */
      public FileTag() {
  
  	super();
  	this.type = "file";
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/FormTag.java
  
  Index: FormTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/FormTag.java,v 1.1 2000/11/03 18:44:58 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:58 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  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.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Custom tag that represents an input form, associated with a bean whose
   * properties correspond to the various fields of the form.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:58 $
   */
  
  public final class FormTag extends TagSupport {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The action URL to which this form should be submitted, if any.
       */
      private String action = null;
  
  
      /**
       * The content encoding to be used on a POST submit.
       */
      private String enctype = null;
  
      public String getEnctype() {
  	return (this.enctype);
      }
  
      public void setEnctype(String enctype) {
  	this.enctype = enctype;
      }
  
  
      /**
       * The name of the field to receive focus, if any.
       */
      private String focus = null;
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The request method used when submitting this form.
       */
      private String method = "POST";
  
  
      /**
       * The attribute key under which our associated bean is stored.
       */
      private String name = null;
  
  
      /**
       * The onReset event script.
       */
      private String onreset = null;
  
  
      /**
       * The onSubmit event script.
       */
      private String onsubmit = null;
  
  
      /**
       * The scope (request or session) under which our associated bean
       * is stored.
       */
      private String scope = "session";
  
  
      /**
       * The style attribute associated with this tag.
       */
      private String style = null;
  
  
      /**
       * The style class associated with this tag.
       */
      private String styleClass = null;
  
  
      /**
       * The window target.
       */
      protected String target = null;
  
  
      /**
       * The Java class name of the bean to be created, if necessary.
       */
      private String type = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the action URL to which this form should be submitted.
       */
      public String getAction() {
  
  	return (this.action);
  
      }
  
  
      /**
       * Set the action URL to which this form should be submitted.
       *
       * @param action The new action URL
       */
      public void setAction(String action) {
  
  	this.action = action;
  
      }
  
  
      /**
       * Return the focus field name for this form.
       */
      public String getFocus() {
  
  	return (this.focus);
  
      }
  
  
      /**
       * Set the focus field name for this form.
       *
       * @param focus The new focus field name
       */
      public void setFocus(String focus) {
  
  	this.focus = focus;
  
      }
  
  
      /**
       * Return the request method used when submitting this form.
       */
      public String getMethod() {
  
  	return (this.method);
  
      }
  
  
      /**
       * Set the request method used when submitting this form.
       *
       * @param method The new request method
       */
      public void setMethod(String method) {
  
  	this.method = method;
  
      }
  
  
      /**
       * Return the attribute key name of our bean.
       */
      public String getName() {
  
  	return (this.name);
  
      }
  
  
      /**
       * Set the attribute key name of our bean.
       *
       * @param name The new attribute key name
       */
      public void setName(String name) {
  
  	this.name = name;
  
      }
  
  
      /**
       * Return the onReset event script.
       */
      public String getOnreset() {
  
  	return (this.onreset);
  
      }
  
  
      /**
       * Set the onReset event script.
       *
       * @param onReset The new event script
       */
      public void setOnreset(String onReset) {
  
  	this.onreset = onReset;
  
      }
  
  
      /**
       * Return the onSubmit event script.
       */
      public String getOnsubmit() {
  
  	return (this.onsubmit);
  
      }
  
  
      /**
       * Set the onSubmit event script.
       *
       * @param onSubmit The new event script
       */
      public void setOnsubmit(String onSubmit) {
  
  	this.onsubmit = onSubmit;
  
      }
  
  
      /**
       * Return the attribute scope of our bean.
       */
      public String getScope() {
  
  	return (this.scope);
  
      }
  
  
      /**
       * Set the attribute scope of our bean.
       *
       * @param scope The new attribute scope
       */
      public void setScope(String scope) {
  
  	this.scope = scope;
  
      }
  
  
      /**
       * Return the style attribute for this tag.
       */
      public String getStyle() {
  
  	return (this.style);
  
      }
  
  
      /**
       * Set the style attribute for this tag.
       *
       * @param style The new style attribute
       */
      public void setStyle(String style) {
  
  	this.style = style;
  
      }
  
  
      /**
       * Return the style class for this tag.
       */
      public String getStyleClass() {
  
  	return (this.styleClass);
  
      }
  
  
      /**
       * Set the style class for this tag.
       *
       * @param styleClass The new style class
       */
      public void setStyleClass(String styleClass) {
  
  	this.styleClass = styleClass;
  
      }
  
  
      /**
       * Return the window target.
       */
      public String getTarget() {
  
  	return (this.target);
  
      }
  
  
      /**
       * Set the window target.
       *
       * @param target The new window target
       */
      public void setTarget(String target) {
  
  	this.target = target;
  
      }
  
  
      /**
       * Return the Java class of our bean.
       */
      public String getType() {
  
  	return (this.type);
  
      }
  
  
      /**
       * Set the Java class of our bean.
       *
       * @param type The new Java class
       */
      public void setType(String type) {
  
  	this.type = type;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Render the beginning of this form.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Create an appropriate "form" element based on our parameters
  	HttpServletResponse response =
  	  (HttpServletResponse) pageContext.getResponse();
  	StringBuffer results = new StringBuffer("<form");
  	results.append(" name=\"");
  	results.append(name);
  	results.append("\"");
  	results.append(" method=\"");
  	results.append(method);
  	results.append("\"");
  	if (action != null) {
  	    results.append(" action=\"");
  	    results.append(response.encodeURL(BeanUtils.filter(action)));
  	    results.append("\"");
  	}
          if (styleClass != null) {
              results.append(" class=\"");
              results.append(styleClass);
              results.append("\"");
          }
  	if (enctype != null) {
  	    results.append(" enctype=\"");
  	    results.append(enctype);
  	    results.append("\"");
  	}
  	if (onreset != null) {
  	    results.append(" onreset=\"");
  	    results.append(onreset);
  	    results.append("\"");
          }
          if (onsubmit != null) {
  	    results.append(" onsubmit=\"");
  	    results.append(onsubmit);
  	    results.append("\"");
  	}
          if (style != null) {
              results.append(" style=\"");
              results.append(style);
              results.append("\"");
          }
  	if (target != null) {
  	    results.append(" target=\"");
  	    results.append(target);
  	    results.append("\"");
  	}
  	results.append(">");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Store this tag itself as a page attribute
  	pageContext.setAttribute(Constants.FORM_KEY, this);
  
  	// Locate or create the bean associated with our form
  	int scope = PageContext.SESSION_SCOPE;
  	if ("request".equals(this.scope))
  	    scope = PageContext.REQUEST_SCOPE;
  	Object bean = pageContext.getAttribute(name, scope);
  	if (bean == null) {
  	    if (type == null)
  	        throw new JspException
  		    (messages.getMessage("getter.bean", name));
  	    try {
  		Class clazz = Class.forName(type);
  		bean = clazz.newInstance();
  	    } catch (Exception e) {
  		throw new JspException
  		    (messages.getMessage("formTag.create", type,
  					 e.toString()));
  	    }
  	    pageContext.setAttribute(name, bean, scope);
  	}
  	pageContext.setAttribute(Constants.BEAN_KEY, bean);
  
  	// Continue processing this page
  	return (EVAL_BODY_INCLUDE);
  
      }
  
  
      /**
       * Render the end of this form.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	// Remove the page scope attributes we created
  	pageContext.removeAttribute(Constants.BEAN_KEY);
  	pageContext.removeAttribute(Constants.FORM_KEY);
  
  	// Render a tag representing the end of our current form
  	StringBuffer results = new StringBuffer("</form>");
  	if (focus != null) {
  	    results.append("\r\n");
  	    results.append("<script language=\"JavaScript\">\r\n");
  	    results.append("  <!--\r\n");
  	    results.append("    document.");
  	    results.append(name);
  	    results.append(".");
  	    results.append(focus);
  	    results.append(".focus()\r\n");
  	    results.append("  // -->\r\n");
  	    results.append("</script>\r\n");
  	}
  
  	// Print this value to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  	        (messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	action = null;
  	enctype = null;
  	focus = null;
  	method = "POST";
  	name = null;
  	onreset = null;
  	onsubmit = null;
  	scope = "session";
  	style = null;
  	styleClass = null;
  	target = null;
  	type = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/HiddenTag.java
  
  Index: HiddenTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/HiddenTag.java,v 1.1 2000/11/03 18:44:58 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:58 $
   *
   * ====================================================================
   * 
   * 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.struts.taglib.form;
  
  
  /**
   * Custom tag for input fields of type "text".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:58 $
   */
  
  public final class HiddenTag extends BaseFieldTag {
  
  
      /**
       * Construct a new instance of this tag.
       */
      public HiddenTag() {
  
  	super();
  	this.type = "hidden";
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/MultiboxTag.java
  
  Index: MultiboxTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/MultiboxTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for input fields of type "checkbox".  This differs from CheckboxTag
   * because it assumes that the underlying property is an array getter (of any
   * supported primitive type, or String), and the checkbox is initialized to
   * "checked" if the value listed for the "value" attribute is present in the
   * values returned by the property getter.
   *
   * @author Ralph Schaer
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class MultiboxTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The name of the bean containing our underlying property.
       */
      private String name = Constants.BEAN_KEY;
  
      public String getName() {
  	return (this.name);
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      /**
       * The property name for this field.
       */
      private String property = null;
  
  
      /**
       * The value which will mark this checkbox as "checked" if present
       * in the array returned by our property getter.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
  
  	return (this.property);
  
      }
  
  
      /**
       * Set the property name.
       *
       * @param property The new property name
       */
      public void setProperty(String property) {
  
  	this.property = property;
  
      }
  
  
      /**
       * Return the server value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the server value.
       *
       * @param value The new server value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Generate the required input tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Create an appropriate "input" element based on our parameters
  	StringBuffer results = new StringBuffer("<input type=\"checkbox\"");
  	results.append(" name=\"");
  	results.append(this.property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	results.append(" value=\"");
  	results.append(this.value);
  	results.append("\"");
  	Object bean = pageContext.findAttribute(name);
  	String values[] = null;
  	if (bean == null)
  	    throw new JspException
  		(messages.getMessage("getter.bean", name));
  	try {
  	    values = BeanUtils.getArrayProperty(bean, property);
  	    if (values == null)
  		values = new String[0];
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	} catch (NoSuchMethodException e) {
  	    throw new JspException
  		(messages.getMessage("getter.method", property, name));
  	}
  	for (int i = 0; i < values.length; i++) {
  	    if (value.equals(values[i])) {
  		results.append(" checked");
  		break;
  	    }
  	}
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Optionally render the associated label from the body content.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	if (bodyContent == null)
  	    return (EVAL_PAGE);
  
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.println(bodyContent.getString().trim());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue evaluating this page
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	name = null;
  	property = null;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/OptionTag.java
  
  Index: OptionTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/OptionTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.lang.reflect.Method;
  import java.io.IOException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.tagext.BodyTagSupport;
  import org.apache.struts.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for select options.  The body of this tag is presented to the user
   * in the option list, while the value attribute is the value returned to
   * the server if this option is selected.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class OptionTag extends BodyTagSupport {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The server value for this option.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the server value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the server value.
       *
       * @param value The new server value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the start of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Do nothing until doEndTag() is called
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Process the end of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	// Acquire the select tag we are associated with
  	SelectTag selectTag =
  	  (SelectTag) pageContext.getAttribute(Constants.SELECT_KEY);
  	if (selectTag == null)
  	    throw new JspException
  	        (messages.getMessage("optionTag.select"));
  
  	// Generate an HTML element
  	StringBuffer results = new StringBuffer();
  	results.append("<option value=\"");
  	results.append(value);
  	results.append("\"");
  	if (value.equals(selectTag.getMatch()))
  	    results.append(" selected");
  	results.append(">");
  	if (bodyContent == null)
  	    results.append(value);
  	else
  	    results.append(bodyContent.getString().trim());
  	results.append("</option>");
  
  	// Render this element to our writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.println(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue evaluating this page
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/OptionsTag.java
  
  Index: OptionsTag.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.struts.taglib.form;
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  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.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  import java.util.Arrays;
  import java.util.Collection;
  import java.util.Iterator;
  import java.util.Map;
  
  
  /**
   * Tag for creating multiple &lt;select&gt; options from a collection.  The
   * associated values displayed to the user may optionally be specified by a
   * second collection, or will be the same as the values themselves.  Each
   * collection may be an array of objects, a Collection, an Iterator, or a
   * Map.  <b>NOTE</b> - This tag requires a Java2 (JDK 1.2 or later) platform.
   *
   * @author Florent Carpentier
   * @author Craig McClanahan
   */
  
  public final class OptionsTag extends TagSupport {
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
      /**
       * The name of the bean containing the labels collection.
       */
      private String labelName = null;
  
      public String getLabelName() {
  	return labelName;
      }
  
      public void setLabelName(String labelName) {
  	this.labelName = labelName;
      }
  
      /**
       * The bean property containing the labels collection.
       */
      private String labelProperty = null;
  
      public String getLabelProperty() {
  	return labelProperty;
      }
  
      public void setLabelProperty(String labelProperty) {
  	this.labelProperty = labelProperty;
      }
  
      /**
       * The name of the bean containing the values collection.
       */
      private String name=null;
  
      public String getName() {
  	return name;
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      /**
       * The name of the property to use to build the values collection.
       */
      private String property=null;
  
      public String getProperty() {
  	return property;
      }
  
      public void setProperty(String property) {
  	this.property = property;
      }
  
  
      /**
       * Process the start of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
  
      public int doStartTag() throws JspException {
  	return SKIP_BODY;
      }
  
      /**
       * Process the end of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	// Acquire the select tag we are associated with
  	SelectTag selectTag =
  	  (SelectTag) pageContext.getAttribute(Constants.SELECT_KEY);
  	if (selectTag == null)
  	    throw new JspException
  	        (messages.getMessage("optionsTag.select"));
  	String match = selectTag.getMatch();
  
  	// Construct iterators for the values and labels collections
  	Iterator valuesIterator = getIterator(name, property);
  	Iterator labelsIterator = null;
  	if ((labelName == null) && (labelProperty == null))
  	    labelsIterator = getIterator(name, property); // Same collection
  	else
  	    labelsIterator = getIterator(labelName, labelProperty);
  
  	// Render the options tags for each element of the values collection
  	StringBuffer sb = new StringBuffer();
  	while (valuesIterator.hasNext()) {
  	    String value = (String) valuesIterator.next();
  	    String label = value;
  	    if (labelsIterator.hasNext())
  	        label = (String) labelsIterator.next();
  	    sb.append("<option value=\"");
  	    sb.append(value);
  	    sb.append("\"");
  	    if (match.equals(value))
  	        sb.append(" selected");
  	    sb.append(">");
  	    sb.append(label);
  	    sb.append("</option>\r\n");
  	}
  
  	// Render this element to our writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(sb.toString());
  	}
  	catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  	return EVAL_PAGE;
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	labelName = null;
  	labelProperty = null;
  	name = null;
  	property = null;
  
      }
  
  
      // -------------------------------------------------------- Private Methods
  
  
      /**
       * Return an iterator for the option labels or values, based on our
       * configured properties.
       *
       * @param name Name of the bean attribute (if any)
       * @param property Name of the bean property (if any)
       *
       * @exception JspException if an error occurs
       */
      private Iterator getIterator(String name, String property)
          throws JspException {
  
  	// Identify the bean containing our collection
  	String beanName = name;
  	if (beanName == null)
  	    beanName = Constants.BEAN_KEY;
  	Object bean = pageContext.findAttribute(beanName);
  	if (bean == null)
  	    throw new JspException
  	        (messages.getMessage("getter.bean", beanName));
  
  	// Identify the collection itself
  	Object collection = bean;
  	if (property != null) {
  	    try {
  		collection = BeanUtils.getPropertyValue(bean, property);
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	    } catch (NoSuchMethodException e) {
  		throw new JspException
  		    (messages.getMessage("getter.method", property, name));
  	    }
  	}
  
  	// Construct and return an appropriate iterator
  	if (collection.getClass().isArray())
  	    collection = Arrays.asList((Object[]) collection);
  	if (collection instanceof Collection)
  	    return (((Collection) collection).iterator());
  	else if (collection instanceof Iterator)
  	    return ((Iterator) collection);
  	else if (collection instanceof Map)
  	    return (((Map) collection).entrySet().iterator());
  	else
  	    throw new JspException
  	        (messages.getMessage("optionsTag.iterator",
  	                             collection.toString()));
  
      }
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/PasswordTag.java
  
  Index: PasswordTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/PasswordTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   * 
   * 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.struts.taglib.form;
  
  
  /**
   * Custom tag for input fields of type "text".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class PasswordTag extends BaseFieldTag {
  
  
      /**
       * Construct a new instance of this tag.
       */
      public PasswordTag() {
  
  	super();
  	this.type = "password";
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/RadioTag.java
  
  Index: RadioTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/RadioTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for input fields of type "radio".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class RadioTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The name of the bean containing our underlying property.
       */
      private String name = Constants.BEAN_KEY;
  
      public String getName() {
  	return (this.name);
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      /**
       * The property name for this field.
       */
      private String property = null;
  
  
      /**
       * The server value for this option.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
  
  	return (this.property);
  
      }
  
  
      /**
       * Set the property name.
       *
       * @param name The new property name
       */
      public void setProperty(String property) {
  
  	this.property = property;
  
      }
  
  
      /**
       * Return the server value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the server value.
       *
       * @param value The new server value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Generate the required input tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Acquire the current value of the appropriate field
  	Object current = null;
  	Object bean = pageContext.findAttribute(name);
  	if (bean == null)
  	    throw new JspException
  	        (messages.getMessage("getter.bean", name));
  	try {
  	    current = BeanUtils.getScalarProperty(bean, property);
  	    if (current == null)
  	        current = "";
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	} catch (NoSuchMethodException e) {
  	    throw new JspException
  	        (messages.getMessage("getter.method", property, name));
  	}
  
  	// Create an appropriate "input" element based on our parameters
  	StringBuffer results = new StringBuffer("<input type=\"radio\"");
  	results.append(" name=\"");
  	results.append(this.property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	results.append(" value=\"");
  	results.append(this.value);
  	results.append("\"");
  	if (value.equals(current))
  	    results.append(" checked");
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_BODY_TAG);
  
      }
  
  
      /**
       * Optionally render the associated label from the body content.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	if (bodyContent == null)
  	    return (EVAL_PAGE);
  
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.println(bodyContent.getString().trim());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue evaluating this page
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	name = Constants.BEAN_KEY;
  	property = null;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/ResetTag.java
  
  Index: ResetTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/ResetTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.lang.reflect.Method;
  import java.io.IOException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for input fields of type "reset".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class ResetTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The name of the generated input field.
       */
      private String name = "reset";
  
  
      /**
       * The value of the button label.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the field name.
       */
      public String getName() {
  
  	return (this.name);
  
      }
  
  
      /**
       * Set the field name.
       *
       * @param name The field name
       */
      public void setName(String name) {
  
  	this.name = name;
  
      }
  
  
      /**
       * Return the label value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the label value.
       *
       * @param value The label value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the start of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Do nothing until doEndTag() is called
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Process the end of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	// Acquire the label value we will be generating
  	String label = value;
  	if ((label == null) && (bodyContent != null))
  	    label = bodyContent.getString().trim();
  	if ((label == null) || (label.length() < 1))
  	    label = "Reset";
  
  	// Generate an HTML element
  	StringBuffer results = new StringBuffer();
  	results.append("<input type=\"reset\" name=\"");
  	results.append(name);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	results.append(" value=\"");
  	results.append(label);
  	results.append("\"");
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Render this element to our writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	name = "reset";
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/SelectTag.java
  
  Index: SelectTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/SelectTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  import javax.servlet.http.HttpServletResponse;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.JspWriter;
  import javax.servlet.jsp.PageContext;
  import org.apache.struts.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Custom tag that represents an HTML select element, associated with a
   * bean property specified by our attributes.  This tag must be nested
   * inside a form tag.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class SelectTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The actual value we will match against, calculated in doStartTag().
       */
      private String match = null;
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * Should multiple selections be allowed?  Any non-null value will
       * trigger rendering this.
       */
      private String multiple = null;
  
      public String getMultiple() {
  	return (this.multiple);
      }
  
      public void setMultiple(String multiple) {
  	this.multiple = multiple;
      }
  
  
      /**
       * The name of the bean containing our underlying property.
       */
      private String name = Constants.BEAN_KEY;
  
      public String getName() {
  	return (this.name);
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      /**
       * The property name we are associated with.
       */
      private String property = null;
  
  
      /**
       * How many available options should be displayed when this element
       * is rendered?
       */
      private String size = null;
  
      public String getSize() {
  	return (this.size);
      }
  
      public void setSize(String size) {
  	this.size = size;
      }
  
  
      /**
       * The value to compare with for marking an option selected.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the actual match value (only valid from nested tags).
       */
      public String getMatch() {
  
  	return (this.match);
  
      }
  
  
      /**
       * Return the property name.
       */
      public String getProperty() {
  
  	return (this.property);
  
      }
  
  
      /**
       * Set the property name.
       *
       * @param property The new property name
       */
      public void setProperty(String property) {
  
  	this.property = property;
  
      }
  
  
      /**
       * Return the comparison value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the comparison value.
       *
       * @param value The new comparison value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Render the beginning of this form.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Create an appropriate "form" element based on our parameters
  	StringBuffer results = new StringBuffer("<select");
  	results.append(" name=\"");
  	results.append(property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (multiple != null) {
  	    results.append(" multiple");
  	}
  	if (size != null) {
  	    results.append(" size=\"");
  	    results.append(size);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.println(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Store this tag itself as a page attribute
  	pageContext.setAttribute(Constants.SELECT_KEY, this);
  
  	// Calculate the match value we will actually be using
  	if (value != null) {
  	    match = value;
          } else {
  	    Object bean = pageContext.findAttribute(name);
  	    if (bean == null)
  		throw new JspException
  		    (messages.getMessage("getter.bean", name));
  	    try {
  		match = BeanUtils.getScalarProperty(bean, property);
  		if (match == null)
  		    match = "";
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	    } catch (NoSuchMethodException e) {
  		throw new JspException
  		    (messages.getMessage("getter.method", property, name));
  	    }
  	}
  
  	// Continue processing this page
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Render the end of this form.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	// Remove the page scope attributes we created
  	pageContext.removeAttribute(Constants.SELECT_KEY);
  
  	// Render a tag representing the end of our current form
  	StringBuffer results = new StringBuffer();
  	if (bodyContent != null)
  	    results.append(bodyContent.getString());
  	results.append("</select>");
  
  	// Print this value to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.println(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  	        (messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	match = null;
  	multiple = null;
  	name = Constants.BEAN_KEY;
  	property = null;
  	size = null;
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/SubmitTag.java
  
  Index: SubmitTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/SubmitTag.java,v 1.1 2000/11/03 18:44:59 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:44:59 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.lang.reflect.Method;
  import java.io.IOException;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspWriter;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Tag for input fields of type "submit".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:44:59 $
   */
  
  public final class SubmitTag extends BaseHandlerTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The message resources for this package.
       */
      protected static MessageResources messages =
  	MessageResources.getMessageResources
  	("org.apache.struts.taglib.LocalStrings");
  
  
      /**
       * The name of the generated input field.
       */
      private String property = "submit";
  
  
      /**
       * The value of the button label.
       */
      private String value = null;
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the property.
       */
      public String getProperty() {
  
  	return (this.property);
  
      }
  
  
      /**
       * Set the property name.
       *
       * @param property The property name
       */
      public void setProperty(String property) {
  
  	this.property = property;
  
      }
  
  
      /**
       * Return the label value.
       */
      public String getValue() {
  
  	return (this.value);
  
      }
  
  
      /**
       * Set the label value.
       *
       * @param value The label value
       */
      public void setValue(String value) {
  
  	this.value = value;
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Process the start of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Do nothing until doEndTag() is called
  	return (EVAL_BODY_TAG);
  
      }
  
  
  
      /**
       * Process the end of this tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doEndTag() throws JspException {
  
  	// Acquire the label value we will be generating
  	String label = value;
  	if ((label == null) && (bodyContent != null))
  	    label = bodyContent.getString().trim();
  	if ((label == null) || (label.length() < 1))
  	    label = "Submit";
  
  	// Generate an HTML element
  	StringBuffer results = new StringBuffer();
  	results.append("<input type=\"submit\" name=\"");
  	results.append(property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	results.append(" value=\"");
  	results.append(label);
  	results.append("\"");
  	results.append(prepareEventHandlers());
  	results.append(prepareStyles());
  	results.append(">");
  
  	// Render this element to our writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	return (EVAL_PAGE);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	property = "submit";
  	value = null;
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/TextTag.java
  
  Index: TextTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/TextTag.java,v 1.1 2000/11/03 18:45:00 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:45:00 $
   *
   * ====================================================================
   * 
   * 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.struts.taglib.form;
  
  
  /**
   * Custom tag for input fields of type "text".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:45:00 $
   */
  
  public final class TextTag extends BaseFieldTag {
  
  
      /**
       * Construct a new instance of this tag.
       */
      public TextTag() {
  
  	super();
  	this.type = "text";
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/taglib/form/TextareaTag.java
  
  Index: TextareaTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/form/TextareaTag.java,v 1.1 2000/11/03 18:45:00 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/11/03 18:45:00 $
   *
   * ====================================================================
   *
   * 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.struts.taglib.form;
  
  
  import java.io.IOException;
  import java.lang.reflect.InvocationTargetException;
  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.taglib.Constants;
  import org.apache.struts.util.BeanUtils;
  import org.apache.struts.util.MessageResources;
  
  
  /**
   * Custom tag for input fields of type "textarea".
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/11/03 18:45:00 $
   */
  
  public class TextareaTag extends BaseInputTag {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The name of the bean containing our underlying property.
       */
      private String name = Constants.BEAN_KEY;
  
      public String getName() {
  	return (this.name);
      }
  
      public void setName(String name) {
  	this.name = name;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Generate the required input tag.
       *
       * @exception JspException if a JSP exception has occurred
       */
      public int doStartTag() throws JspException {
  
  	// Create an appropriate "input" element based on our parameters
  	StringBuffer results = new StringBuffer("<textarea");
  	results.append(" name=\"");
  	results.append(property);
  	results.append("\"");
  	if (accesskey != null) {
  	    results.append(" accesskey=\"");
  	    results.append(accesskey);
  	    results.append("\"");
  	}
  	if (tabindex != null) {
  	    results.append(" tabindex=\"");
  	    results.append(tabindex);
  	    results.append("\"");
  	}
  	if (cols != null) {
  	    results.append(" cols=\"");
  	    results.append(cols);
  	    results.append("\"");
  	}
  	if (rows != null) {
  	    results.append(" rows=\"");
  	    results.append(rows);
  	    results.append("\"");
  	}
          results.append(prepareEventHandlers());
          results.append(prepareStyles());
  	results.append(">");
  	if (value != null) {
  	    results.append(BeanUtils.filter(value));
  	} else {
  	    Object bean = pageContext.findAttribute(name);
  	    if (bean == null)
  		throw new JspException
  		    (messages.getMessage("getter.bean", name));
  	    try {
  		String value = BeanUtils.getScalarProperty(bean, property);
  		if (value == null)
  		    value = "";
  		results.append(BeanUtils.filter((String) value));
  	    } catch (IllegalAccessException e) {
  		throw new JspException
  		    (messages.getMessage("getter.access", property, name));
  	    } catch (InvocationTargetException e) {
  		Throwable t = e.getTargetException();
  		throw new JspException
  		    (messages.getMessage("getter.result",
  					 property, t.toString()));
  	    } catch (NoSuchMethodException e) {
  		throw new JspException
  		    (messages.getMessage("getter.method", property, name));
  	    }
  	}
  	results.append("</textarea>");
  
  	// Print this field to our output writer
  	JspWriter writer = pageContext.getOut();
  	try {
  	    writer.print(results.toString());
  	} catch (IOException e) {
  	    throw new JspException
  		(messages.getMessage("common.io", e.toString()));
  	}
  
  	// Continue processing this page
  	return (EVAL_BODY_TAG);
  
      }
  
  
      /**
       * Release any acquired resources.
       */
      public void release() {
  
  	super.release();
  	name = Constants.BEAN_KEY;
  
      }
  
  
  }
  
  
  

Mime
View raw message