You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/09/05 23:25:47 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/bean CookieTag.java LocalStrings.properties WriteTag.java

craigmcc    00/09/05 14:25:46

  Modified:    src/doc  struts-bean.xml
               src/share/org/apache/struts/taglib/bean CookieTag.java
                        LocalStrings.properties WriteTag.java
  Log:
  Check in some corrections to the new "struts-bean" custom tags that were
  uncovered by a small test suite that will be checked in next.  These tags
  now appear ready for use.
  
  As described in the TODO document, the existing Struts tags are getting
  separated into smaller libraries that have functional coherence.  You will
  be able to use them together with no problems -- however, the individual
  libraries will often be useful on their own as well.
  
  Revision  Changes    Path
  1.3       +8 -8      jakarta-struts/src/doc/struts-bean.xml
  
  Index: struts-bean.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/doc/struts-bean.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- struts-bean.xml	2000/09/05 01:33:20	1.2
  +++ struts-bean.xml	2000/09/05 21:25:44	1.3
  @@ -74,7 +74,7 @@
       <attribute>
         <name>name</name>
         <required>true</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the name of the request cookie whose value, or values,
         is to be retrieved.</p>
  @@ -119,7 +119,7 @@
       <attribute>
         <name>name</name>
         <required>true</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the attribute name of the bean whose property is accessed
         to define a new page scope attribute (if <code>property</code> is also
  @@ -145,7 +145,7 @@
       <attribute>
         <name>scope</name>
         <required>false</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the variable scope searched to retrieve the bean specified
         by <code>name</code>.  If not specified, the default rules applied by
  @@ -156,7 +156,7 @@
       <attribute>
         <name>type</name>
         <required>false</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the fully qualified class name of the value to be exposed
         as the <code>id</code> attribute.  If not specified, the default type
  @@ -216,7 +216,7 @@
       <attribute>
         <name>name</name>
         <required>true</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the name of the request header whose value, or values,
         is to be retrieved.</p>
  @@ -319,7 +319,7 @@
       <attribute>
         <name>name</name>
         <required>true</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the name of the request parameter whose value, or values,
         is to be retrieved.</p>
  @@ -418,7 +418,7 @@
       <attribute>
         <name>name</name>
         <required>true</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the attribute name of the bean whose property is accessed
         to retrieve the value specified by <code>property</code> (if
  @@ -442,7 +442,7 @@
       <attribute>
         <name>scope</name>
         <required>false</required>
  -      <rtexprvalue>false</rtexprvalue>
  +      <rtexprvalue>true</rtexprvalue>
         <info>
         <p>Specifies the variable scope searched to retrieve the bean specified
         by <code>name</code>.  If not specified, the default rules applied by
  
  
  
  1.2       +5 -4      jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java
  
  Index: CookieTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CookieTag.java	2000/08/29 05:22:29	1.1
  +++ CookieTag.java	2000/09/05 21:25:45	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java,v 1.1 2000/08/29 05:22:29 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/29 05:22:29 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/CookieTag.java,v 1.2 2000/09/05 21:25:45 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/09/05 21:25:45 $
    *
    * ====================================================================
    *
  @@ -81,7 +81,7 @@
    * cookie received with this request.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/29 05:22:29 $
  + * @version $Revision: 1.2 $ $Date: 2000/09/05 21:25:45 $
    */
   
   public final class CookieTag extends TagSupport {
  @@ -157,6 +157,7 @@
               ((HttpServletRequest) pageContext.getRequest()).getCookies();
           if (cookies == null)
               cookies = new Cookie[0];
  +
           for (int i = 0; i < cookies.length; i++) {
               if (name.equals(cookies[i].getName()))
                   values.addElement(cookies[i]);
  
  
  
  1.5       +1 -0      jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalStrings.properties	2000/09/05 01:33:21	1.4
  +++ LocalStrings.properties	2000/09/05 21:25:45	1.5
  @@ -1,4 +1,5 @@
   getter.access=IllegalAccessException accessing property {0} of bean {1}
  +getter.argument=IllegalArgumentException: {0}
   getter.bean=No bean found for attribute key {0}
   getter.cookie=No cookie {0} was included in this request
   getter.header=No header {0} was included in this request
  
  
  
  1.2       +13 -8     jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java
  
  Index: WriteTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WriteTag.java	2000/08/31 00:11:15	1.1
  +++ WriteTag.java	2000/09/05 21:25:45	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v 1.1 2000/08/31 00:11:15 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/31 00:11:15 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/WriteTag.java,v 1.2 2000/09/05 21:25:45 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/09/05 21:25:45 $
    *
    * ====================================================================
    * 
  @@ -80,7 +80,7 @@
    * output stream, optionally filtering characters that are sensitive in HTML.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/31 00:11:15 $
  + * @version $Revision: 1.2 $ $Date: 2000/09/05 21:25:45 $
    */
   
   public final class WriteTag extends TagSupport {
  @@ -171,12 +171,17 @@
           try {
   
               // Locate the specified bean
  -	    bean = BeanUtils.lookup(pageContext, name, scope);
  -
  -            // Locate the specified property
  +            try {
  +                bean = BeanUtils.lookup(pageContext, name, scope);
  +            } catch (IllegalArgumentException e) {
  +                throw new JspException
  +                    (messages.getMessage("getter.scope", scope));
  +            }
               if (bean == null)
                   throw new JspException
                       (messages.getMessage("getter.bean", name));
  +
  +            // Locate the specified property
               if (property == null)
                   value = bean;
               else
  @@ -195,7 +200,7 @@
                   (messages.getMessage("getter.access", property, name));
   	} catch (IllegalArgumentException e) {
   	    throw new JspException
  -	      (messages.getMessage("getter.scope", scope));
  +	      (messages.getMessage("getter.argument", e.toString()));
           } catch (InvocationTargetException e) {
               Throwable t = e.getTargetException();
               throw new JspException