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

2003-09-17 Thread rleland
rleland 2003/09/17 08:31:35

  Modified:src/share/org/apache/struts/taglib/html RadioTag.java
  Log:
  Bug#: 23215
Release idName on cleanup.
  
  Revision  ChangesPath
  1.25  +5 -4  
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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- RadioTag.java 31 Jul 2003 00:19:04 -  1.24
  +++ RadioTag.java 17 Sep 2003 15:31:35 -  1.25
  @@ -328,6 +328,7 @@
   public void release() {
   
   super.release();
  +idName = null;
   name = Constants.BEAN_KEY;
   property = null;
   text = null;
  
  
  

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



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

2003-03-22 Thread dgraham
dgraham 2003/03/22 10:39:10

  Modified:src/share/org/apache/struts/taglib/html RadioTag.java
  Log:
  Added braces to if statements and other small formatting fixes.
  
  Revision  ChangesPath
  1.20  +44 -39
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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- RadioTag.java 16 Dec 2002 03:41:43 -  1.19
  +++ RadioTag.java 22 Mar 2003 18:39:10 -  1.20
  @@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
  @@ -64,7 +64,9 @@
   
   
   import java.lang.reflect.InvocationTargetException;
  +
   import javax.servlet.jsp.JspException;
  +
   import org.apache.commons.beanutils.BeanUtils;
   import org.apache.struts.util.MessageResources;
   import org.apache.struts.util.RequestUtils;
  @@ -221,51 +223,51 @@
* @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 = RequestUtils.lookup(pageContext, name, null);
  -if (bean == null)
  -throw new JspException
  -(messages.getMessage(getter.bean, name));
  +if (bean == null) {
  +throw new JspException(messages.getMessage(getter.bean, name));
  +}
  +
   try {
  -
   current = BeanUtils.getProperty(bean, property);
  -if (current == null)
  +if (current == null) {
   current = ;
  -
  +}
  +
   // @since Struts 1.1
   if (idName != null) {
   Object idBean = RequestUtils.lookup(pageContext, idName, null);
  -if (idBean == null)
  -   throw new JspException
  -(messages.getMessage(getter.bean, idName));
  +if (idBean == null) {
  +throw new JspException(messages.getMessage(getter.bean, 
idName));
  +}
   value = BeanUtils.getProperty(idBean, value);
  -if (value == null) value = ;
  +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 (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));
  +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=\);
   // @since Struts 1.1
  -if( indexed )
  -prepareIndex( results, name );
  +if (indexed) {
  +prepareIndex(results, name);
  +}
   results.append(this.property);
   results.append(\);
   if (accesskey != null) {
  @@ -281,15 +283,16 @@
   results.append( value=\);
   results.append(this.value);
   results.append(\);
  -if (value.equals(current.toString()))
  +if (value.equals(current.toString())) {
   results.append( checked=\checked\);
  +}
   results.append(prepareEventHandlers());
   results.append(prepareStyles());
   results.append(getElementClose());
  -
  +
   // Print this field to our output writer
   ResponseUtils.write(pageContext, 

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

2003-03-22 Thread dgraham
dgraham 2003/03/22 10:46:12

  Modified:src/share/org/apache/struts/taglib/html RadioTag.java
  Log:
  Use temp variable instead of overwriting tag attribute variable.  PR #18186.
  
  Revision  ChangesPath
  1.21  +12 -9 
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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RadioTag.java 22 Mar 2003 18:39:10 -  1.20
  +++ RadioTag.java 22 Mar 2003 18:46:12 -  1.21
  @@ -231,6 +231,9 @@
   throw new JspException(messages.getMessage(getter.bean, name));
   }
   
  +// Cannot change this.value so use a temp variable
  +String tempValue = this.value;
  +
   try {
   current = BeanUtils.getProperty(bean, property);
   if (current == null) {
  @@ -243,9 +246,9 @@
   if (idBean == null) {
   throw new JspException(messages.getMessage(getter.bean, 
idName));
   }
  -value = BeanUtils.getProperty(idBean, value);
  -if (value == null) {
  -value = ;
  +tempValue = BeanUtils.getProperty(idBean, this.value);
  +if (tempValue == null) {
  +tempValue = ;
   }
   }
   
  @@ -281,9 +284,9 @@
   results.append(\);
   }
   results.append( value=\);
  -results.append(this.value);
  +results.append(tempValue);
   results.append(\);
  -if (value.equals(current.toString())) {
  +if (tempValue.equals(current.toString())) {
   results.append( checked=\checked\);
   }
   results.append(prepareEventHandlers());
  
  
  

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



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

2002-07-07 Thread husted

husted  2002/07/07 16:27:57

  Modified:src/share/org/apache/struts/taglib/html RadioTag.java
  Log:
  Add idName attribute  to RadioTag so that it is easy to use with an iterator.
  
  Revision  ChangesPath
  1.13  +60 -4 
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RadioTag.java 25 Jun 2002 00:45:41 -  1.12
  +++ RadioTag.java 7 Jul 2002 23:27:57 -   1.13
  @@ -77,6 +77,7 @@
* Tag for input fields of type radio.
*
* @author Craig R. McClanahan
  + * @author Ted Husted
* @version $Revision$ $Date$
*/
   
  @@ -125,6 +126,20 @@
   protected String value = null;
   
   
  +/**
  + * Name of the bean (in some scope) that will return the
  + * value of the radio tag.
  + * p
  + * If an iterator is used to render a series of radio tags,
  + * this field may be used to specify the name of the bean
  + * exposed by the iterator. In this case, the value attribute is
  + * used as the name of a property on the codeidName/code bean
  + * that returns the value of the radio tag in this iteration.
  + */
  +protected String idName = null;
  +
  +
  +
   // - Properties
   
   
  @@ -172,6 +187,32 @@
   }
   
   
  +
  +/**
  + * Return the idName.
  + * @since Struts 1.1
  + */
  +public String getIdName() {
  +
  +return (this.idName);
  +
  +}
  +
  +
  +/**
  + * Set the idName.
  + * @since Struts 1.1
  + *
  + * @param value The new idName
  + */
  +public void setIdName(String idName) {
  +
  +this.idName=idName;
  +
  +}
  +
  +
  +
   // - Public Methods
   
   
  @@ -190,9 +231,22 @@
   throw new JspException
   (messages.getMessage(getter.bean, name));
   try {
  +
   current = BeanUtils.getProperty(bean, property);
   if (current == null)
   current = ;
  +
  +// @since Struts 1.1
  +if (idName != null) {
  +Object idBean = pageContext.findAttribute(idName);
  +if (idBean == null)
  +   throw new JspException
  +(messages.getMessage(getter.bean, idName));
  +value = BeanUtils.getProperty(idBean, value);
  +if (value == null) value = ;
  +}
  +
  +
   } catch (IllegalAccessException e) {
   throw new JspException
   (messages.getMessage(getter.access, property, name));
  @@ -205,6 +259,8 @@
   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\);
  
  
  

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




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

2002-03-20 Thread craigmcc

craigmcc02/03/20 18:41:20

  Modified:src/share/org/apache/struts/taglib/html RadioTag.java
  Log:
  Compare the the current property value after making it a String, so that you
  can (for example) use a boolean property and compare to values true and
  false.
  
  PR: Bugzilla #4028
  Submitted by: Dmitri Plotnikov dmitri at plotnix.com
  
  Revision  ChangesPath
  1.11  +5 -5  
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RadioTag.java 11 Dec 2001 17:54:28 -  1.10
  +++ RadioTag.java 21 Mar 2002 02:41:20 -  1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v 1.10 
2001/12/11 17:54:28 oalexeev Exp $
  - * $Revision: 1.10 $
  - * $Date: 2001/12/11 17:54:28 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v 1.11 
2002/03/21 02:41:20 craigmcc Exp $
  + * $Revision: 1.11 $
  + * $Date: 2002/03/21 02:41:20 $
*
* 
*
  @@ -77,7 +77,7 @@
* Tag for input fields of type radio.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2001/12/11 17:54:28 $
  + * @version $Revision: 1.11 $ $Date: 2002/03/21 02:41:20 $
*/
   
   public class RadioTag extends BaseHandlerTag {
  @@ -227,7 +227,7 @@
   results.append( value=\);
   results.append(this.value);
   results.append(\);
  -if (value.equals(current))
  +if (value.equals(current.toString()))
   results.append( checked=\checked\);
   results.append(prepareEventHandlers());
   results.append(prepareStyles());
  
  
  

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




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

2002-03-20 Thread craigmcc

craigmcc02/03/20 18:43:09

  Modified:src/share/org/apache/struts/taglib/html Tag:
STRUTS_1_0_BRANCH RadioTag.java
  Log:
  Port fix for 4028.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.3.2.3   +5 -5  
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.3.2.2
  retrieving revision 1.3.2.3
  diff -u -r1.3.2.2 -r1.3.2.3
  --- RadioTag.java 10 Jun 2001 03:51:41 -  1.3.2.2
  +++ RadioTag.java 21 Mar 2002 02:43:09 -  1.3.2.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v 
1.3.2.2 2001/06/10 03:51:41 craigmcc Exp $
  - * $Revision: 1.3.2.2 $
  - * $Date: 2001/06/10 03:51:41 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/RadioTag.java,v 
1.3.2.3 2002/03/21 02:43:09 craigmcc Exp $
  + * $Revision: 1.3.2.3 $
  + * $Date: 2002/03/21 02:43:09 $
*
* 
*
  @@ -77,7 +77,7 @@
* Tag for input fields of type radio.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3.2.2 $ $Date: 2001/06/10 03:51:41 $
  + * @version $Revision: 1.3.2.3 $ $Date: 2002/03/21 02:43:09 $
*/
   
   public class RadioTag extends BaseHandlerTag {
  @@ -223,7 +223,7 @@
results.append( value=\);
results.append(this.value);
results.append(\);
  - if (value.equals(current))
  + if (value.equals(current.toString()))
results.append( checked=\checked\);
results.append(prepareEventHandlers());
results.append(prepareStyles());
  
  
  

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