You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by oa...@apache.org on 2001/09/05 18:03:57 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/html ImageTag.java RadioTag.java TextareaTag.java

oalexeev    01/09/05 09:03:57

  Modified:    src/share/org/apache/struts/taglib/html ImageTag.java
                        RadioTag.java TextareaTag.java
  Log:
  Add indexed attribute support to ImageTag, RadioTag and TextareaTag
  
  Revision  Changes    Path
  1.9       +8 -6      jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java
  
  Index: ImageTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ImageTag.java	2001/04/19 21:09:30	1.8
  +++ ImageTag.java	2001/09/05 16:03:57	1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java,v 1.8 2001/04/19 21:09:30 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/04/19 21:09:30 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/ImageTag.java,v 1.9 2001/09/05 16:03:57 oalexeev Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/09/05 16:03:57 $
    *
    * ====================================================================
    *
  @@ -81,7 +81,7 @@
    * Tag for input fields of type "image".
    *
    * @author Oleg V Alexeev
  - * @version $Revision: 1.8 $ $Date: 2001/04/19 21:09:30 $
  + * @version $Revision: 1.9 $ $Date: 2001/09/05 16:03:57 $
    */
   
   public class ImageTag extends SubmitTag {
  @@ -203,11 +203,11 @@
       protected String property = "";
   
       public String getProperty() {
  -	return (this.property);
  +        return (this.property);
       }
   
       public void setProperty(String property) {
  -	this.property = property;
  +        this.property = property;
       }
   
   
  @@ -268,6 +268,8 @@
           String tmp = null;
           StringBuffer results = new StringBuffer();
           results.append("<input type=\"image\" name=\"");
  +        if( indexed )
  +                prepareIndex( results, null );
           results.append(property);
           results.append("\"");
           tmp = src();
  
  
  
  1.7       +67 -65    jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java
  
  Index: RadioTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RadioTag.java	2001/07/16 00:44:55	1.6
  +++ RadioTag.java	2001/09/05 16:03:57	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v 1.6 2001/07/16 00:44:55 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/07/16 00:44:55 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v 1.7 2001/09/05 16:03:57 oalexeev Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/09/05 16:03:57 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * Tag for input fields of type "radio".
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/07/16 00:44:55 $
  + * @version $Revision: 1.7 $ $Date: 2001/09/05 16:03:57 $
    */
   
   public class RadioTag extends BaseHandlerTag {
  @@ -99,11 +99,11 @@
       protected String name = Constants.BEAN_KEY;
   
       public String getName() {
  -	return (this.name);
  +        return (this.name);
       }
   
       public void setName(String name) {
  -	this.name = name;
  +        this.name = name;
       }
   
   
  @@ -133,7 +133,7 @@
        */
       public String getProperty() {
   
  -	return (this.property);
  +        return (this.property);
   
       }
   
  @@ -145,7 +145,7 @@
        */
       public void setProperty(String property) {
   
  -	this.property = property;
  +        this.property = property;
   
       }
   
  @@ -155,7 +155,7 @@
        */
       public String getValue() {
   
  -	return (this.value);
  +        return (this.value);
   
       }
   
  @@ -167,7 +167,7 @@
        */
       public void setValue(String value) {
   
  -	this.value = value;
  +        this.value = value;
   
       }
   
  @@ -182,59 +182,61 @@
        */
       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.getProperty(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=\"checked\"");
  -	results.append(prepareEventHandlers());
  -	results.append(prepareStyles());
  -	results.append(">");
  +        // 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.getProperty(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=\"");
  +        if( indexed )
  +                prepareIndex( results, 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=\"checked\"");
  +        results.append(prepareEventHandlers());
  +        results.append(prepareStyles());
  +        results.append(">");
   
  -	// Print this field to our output writer
  +        // Print this field to our output writer
           ResponseUtils.write(pageContext, results.toString());
   
  -	// Continue processing this page
  +        // Continue processing this page
           this.text = null;
  -	return (EVAL_BODY_TAG);
  +        return (EVAL_BODY_TAG);
   
       }
   
  @@ -267,8 +269,8 @@
           if (text != null)
               ResponseUtils.write(pageContext, text);
   
  -	// Evaluate the remainder of this page
  -	return (EVAL_PAGE);
  +        // Evaluate the remainder of this page
  +        return (EVAL_PAGE);
   
       }
   
  @@ -278,11 +280,11 @@
        */
       public void release() {
   
  -	super.release();
  -	name = Constants.BEAN_KEY;
  -	property = null;
  +        super.release();
  +        name = Constants.BEAN_KEY;
  +        property = null;
           text = null;
  -	value = null;
  +        value = null;
   
       }
   
  
  
  
  1.6       +65 -63    jakarta-struts/src/share/org/apache/struts/taglib/html/TextareaTag.java
  
  Index: TextareaTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/TextareaTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TextareaTag.java	2001/07/16 00:44:55	1.5
  +++ TextareaTag.java	2001/09/05 16:03:57	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/TextareaTag.java,v 1.5 2001/07/16 00:44:55 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/07/16 00:44:55 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/TextareaTag.java,v 1.6 2001/09/05 16:03:57 oalexeev Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/09/05 16:03:57 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
    * Custom tag for input fields of type "textarea".
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/07/16 00:44:55 $
  + * @version $Revision: 1.6 $ $Date: 2001/09/05 16:03:57 $
    */
   
   public class TextareaTag extends BaseInputTag {
  @@ -93,11 +93,11 @@
       protected String name = Constants.BEAN_KEY;
   
       public String getName() {
  -	return (this.name);
  +        return (this.name);
       }
   
       public void setName(String name) {
  -	this.name = name;
  +        this.name = name;
       }
   
   
  @@ -111,66 +111,68 @@
        */
       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("\"");
  -	}
  +        // Create an appropriate "input" element based on our parameters
  +        StringBuffer results = new StringBuffer("<textarea");
  +        results.append(" name=\"");
  +        if( indexed )
  +                prepareIndex( results, 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(ResponseUtils.filter(value));
  -	} else {
  -	    Object bean = pageContext.findAttribute(name);
  -	    if (bean == null)
  -		throw new JspException
  -		    (messages.getMessage("getter.bean", name));
  -	    try {
  -		String value = BeanUtils.getProperty(bean, property);
  -		if (value == null)
  -		    value = "";
  -		results.append(ResponseUtils.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>");
  +        results.append(">");
  +        if (value != null) {
  +            results.append(ResponseUtils.filter(value));
  +        } else {
  +            Object bean = pageContext.findAttribute(name);
  +            if (bean == null)
  +                throw new JspException
  +                    (messages.getMessage("getter.bean", name));
  +            try {
  +                String value = BeanUtils.getProperty(bean, property);
  +                if (value == null)
  +                    value = "";
  +                results.append(ResponseUtils.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
  +        // Print this field to our output writer
           ResponseUtils.write(pageContext, results.toString());
   
  -	// Continue processing this page
  -	return (EVAL_BODY_TAG);
  +        // Continue processing this page
  +        return (EVAL_BODY_TAG);
   
       }
   
  @@ -180,8 +182,8 @@
        */
       public void release() {
   
  -	super.release();
  -	name = Constants.BEAN_KEY;
  +        super.release();
  +        name = Constants.BEAN_KEY;
   
       }