craigmcc    2002/12/15 19:41:43

  Modified:    src/share/org/apache/struts/taglib/html MultiboxTag.java
                        OptionsTag.java RadioTag.java SelectTag.java
                        TextareaTag.java
               src/share/org/apache/struts/taglib/logic IterateTag.java
  Log:
  Consistently use RequestUtils.lookup() instead of pageContext.findAttribute()
  to locate attribute values in any scope.
  
  PR: Bugzilla #15309
  Submitted by: Michael Han <mhan810 at yahoo.com>
  
  Revision  Changes    Path
  1.18      +6 -5      
jakarta-struts/src/share/org/apache/struts/taglib/html/MultiboxTag.java
  
  Index: MultiboxTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/MultiboxTag.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- MultiboxTag.java  16 Nov 2002 06:05:22 -0000      1.17
  +++ MultiboxTag.java  16 Dec 2002 03:41:43 -0000      1.18
  @@ -69,6 +69,7 @@
   import org.apache.commons.beanutils.BeanUtils;
   import org.apache.struts.Globals;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
   
   /**
  @@ -229,7 +230,7 @@
           }
           results.append(ResponseUtils.filter(value));
           results.append("\"");
  -        Object bean = pageContext.findAttribute(name);
  +        Object bean = RequestUtils.lookup(pageContext, name, null);
           String values[] = null;
           if (bean == null)
               throw new JspException(messages.getMessage("getter.bean", name));
  
  
  
  1.20      +2 -1      
jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java
  
  Index: OptionsTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- OptionsTag.java   4 Oct 2002 05:34:19 -0000       1.19
  +++ OptionsTag.java   16 Dec 2002 03:41:43 -0000      1.20
  @@ -68,6 +68,7 @@
   import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.struts.util.IteratorAdapter;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
   
   
  @@ -412,7 +413,7 @@
        String beanName = name;
        if (beanName == null)
            beanName = Constants.BEAN_KEY;
  -     Object bean = pageContext.findAttribute(beanName);
  +        Object bean = RequestUtils.lookup(pageContext, beanName, null);
        if (bean == null)
            throw new JspException
                (messages.getMessage("getter.bean", beanName));
  
  
  
  1.19      +7 -6      
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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RadioTag.java     16 Nov 2002 06:05:21 -0000      1.18
  +++ RadioTag.java     16 Dec 2002 03:41:43 -0000      1.19
  @@ -67,6 +67,7 @@
   import javax.servlet.jsp.JspException;
   import org.apache.commons.beanutils.BeanUtils;
   import org.apache.struts.util.MessageResources;
  +import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
   
   
  @@ -223,7 +224,7 @@
   
           // Acquire the current value of the appropriate field
           Object current = null;
  -        Object bean = pageContext.findAttribute(name);
  +        Object bean = RequestUtils.lookup(pageContext, name, null);
           if (bean == null)
               throw new JspException
                   (messages.getMessage("getter.bean", name));
  @@ -235,7 +236,7 @@
   
               // @since Struts 1.1
               if (idName != null) {
  -                Object idBean = pageContext.findAttribute(idName);
  +                Object idBean = RequestUtils.lookup(pageContext, idName, null);
                   if (idBean == null)
                      throw new JspException
                       (messages.getMessage("getter.bean", idName));
  
  
  
  1.14      +5 -5      
jakarta-struts/src/share/org/apache/struts/taglib/html/SelectTag.java
  
  Index: SelectTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/SelectTag.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SelectTag.java    23 Sep 2002 05:13:43 -0000      1.13
  +++ SelectTag.java    16 Dec 2002 03:41:43 -0000      1.14
  @@ -279,7 +279,7 @@
               match = new String[1];
               match[0] = value;
           } else {
  -            Object bean = pageContext.findAttribute(name);
  +            Object bean = RequestUtils.lookup(pageContext, name, null);
               if (bean == null) {
                   JspException e = new JspException
                       (messages.getMessage("getter.bean", name));
  
  
  
  1.12      +6 -5      
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TextareaTag.java  23 Sep 2002 05:13:43 -0000      1.11
  +++ TextareaTag.java  16 Dec 2002 03:41:43 -0000      1.12
  @@ -66,6 +66,7 @@
   import java.lang.reflect.InvocationTargetException;
   import javax.servlet.jsp.JspException;
   import org.apache.commons.beanutils.BeanUtils;
  +import org.apache.struts.util.RequestUtils;
   import org.apache.struts.util.ResponseUtils;
   
   
  @@ -141,7 +142,7 @@
           if (value != null) {
               results.append(ResponseUtils.filter(value));
           } else {
  -            Object bean = pageContext.findAttribute(name);
  +            Object bean = RequestUtils.lookup(pageContext, name, null);
               if (bean == null)
                   throw new JspException
                       (messages.getMessage("getter.bean", name));
  
  
  
  1.17      +8 -8      
jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java
  
  Index: IterateTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- IterateTag.java   23 Sep 2002 05:22:08 -0000      1.16
  +++ IterateTag.java   16 Dec 2002 03:41:43 -0000      1.17
  @@ -344,8 +344,8 @@
            try {
                offsetValue = Integer.parseInt(offset);
            } catch (NumberFormatException e) {
  -             Integer offsetObject =
  -               (Integer) pageContext.findAttribute(offset);
  +             Integer offsetObject = (Integer)
  +                    RequestUtils.lookup(pageContext, offset, null);
                if (offsetObject == null)
                    offsetValue = 0;
                else
  @@ -362,8 +362,8 @@
            try {
                lengthValue = Integer.parseInt(length);
            } catch (NumberFormatException e) {
  -             Integer lengthObject =
  -               (Integer) pageContext.findAttribute(length);
  +             Integer lengthObject = (Integer)
  +                    RequestUtils.lookup(pageContext, length, null);
                if (lengthObject == null)
                    lengthValue = 0;
                else
  
  
  

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

Reply via email to