struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/logic EmptyTag.java
Date Sat, 10 May 2003 18:06:41 GMT
dgraham     2003/05/10 11:06:40

  Modified:    src/share/org/apache/struts/util RequestUtils.java
               web/exercise-taglib logic-empty.jsp
               src/share/org/apache/struts/taglib/logic EmptyTag.java
  Log:
  Fixed EmptyTag and added test to exercise-taglib webapp
  for PR# 19773.
  
  Revision  Changes    Path
  1.101     +7 -6      jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- RequestUtils.java	10 May 2003 17:37:43 -0000	1.100
  +++ RequestUtils.java	10 May 2003 18:06:39 -0000	1.101
  @@ -881,13 +881,14 @@
               saveException(pageContext, e);
               throw e;
           }
  +        
           if (property == null) {
  -            return (bean);
  +            return bean;
           }
   
           // Locate and return the specified property
           try {
  -            return (PropertyUtils.getProperty(bean, property));
  +            return PropertyUtils.getProperty(bean, property);
               
           } catch (IllegalAccessException e) {
               saveException(pageContext, e);
  
  
  
  1.3       +25 -0     jakarta-struts/web/exercise-taglib/logic-empty.jsp
  
  Index: logic-empty.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/web/exercise-taglib/logic-empty.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- logic-empty.jsp	12 Oct 2002 19:21:18 -0000	1.2
  +++ logic-empty.jsp	10 May 2003 18:06:40 -0000	1.3
  @@ -19,6 +19,31 @@
       <th>Test Result</th>
     </tr>
     <tr>
  +    <td>missing bean, no property attribute</td>
  +    <td>empty</td>
  +    <td>
  +      <logic:empty name="missingBean">
  +        empty
  +      </logic:empty>
  +      <logic:notEmpty name="missingBean">
  +        notEmpty
  +      </logic:notEmpty>
  +    </td>
  +  </tr>
  +  <tr>
  +    <td>not-missing bean, no property attribute</td>
  +    <td>notEmpty</td>
  +    <td>
  +      <logic:empty name="bean">
  +        empty
  +      </logic:empty>
  +      <logic:notEmpty name="bean">
  +        notEmpty
  +      </logic:notEmpty>
  +    </td>
  +  </tr>
  +
  +  <tr>
       <td>null</td>
       <td>empty</td>
       <td>
  
  
  
  1.7       +11 -5     jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java
  
  Index: EmptyTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/EmptyTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EmptyTag.java	10 May 2003 17:37:44 -0000	1.6
  +++ EmptyTag.java	10 May 2003 18:06:40 -0000	1.7
  @@ -115,7 +115,13 @@
   		}
   
   		boolean empty = true;
  -		Object value = RequestUtils.lookup(pageContext, name, property, scope);
  +        
  +		Object value = null;
  +		if (this.property == null) {
  +			value = RequestUtils.lookup(pageContext, name, scope);
  +		} else {
  +			value = RequestUtils.lookup(pageContext, name, property, scope);
  +		}
           
   		if (value != null) {
               
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org


Mime
View raw message