martinc     2002/08/09 19:00:38

  Modified:    src/share/org/apache/struts/taglib/html FormTag.java
               src/share/org/apache/struts/taglib/nested
                        NestedPropertyHelper.java
               src/share/org/apache/struts/taglib/nested/html
                        NestedFormTag.java
  Log:
  Make the derived form bean name available from the form tag, so that the
  nested tags have access to that. The nested tags were previously taking
  advantage of the fact that the 'name' attribute was being modified to hold
  the derived bean name. Fixing the form tag to not do that therefore broke
  the nested tags. Now the nested tags call getBeanName() instead of
  getName().
  
  PR: 11598
  Submitted by: Steve Byrne
  
  Revision  Changes    Path
  1.27      +21 -7     
jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
  
  Index: FormTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- FormTag.java      7 Aug 2002 05:25:03 -0000       1.26
  +++ FormTag.java      10 Aug 2002 02:00:38 -0000      1.27
  @@ -210,7 +210,7 @@
        * as the 'name' attribute, if that was specified, or is obtained from the
        * associated <code>ActionMapping</code> otherwise.
        */
  -    private String beanName = null;
  +    protected String beanName = null;
   
   
       /**
  @@ -218,17 +218,31 @@
        * as the 'scope' attribute, if that was specified, or is obtained from the
        * associated <code>ActionMapping</code> otherwise.
        */
  -    private String beanScope = null;
  +    protected String beanScope = null;
  +
   
       /**
        * The type of the form bean to (create and) use. This is either the same
        * as the 'type' attribute, if that was specified, or is obtained from the
        * associated <code>ActionMapping</code> otherwise.
        */
  -    private String beanType = null;
  +    protected String beanType = null;
   
   
       // ------------------------------------------------------------- Properties
  +
  +
  +    /**
  +     * Return the name of the form bean corresponding to this tag. There is
  +     * no corresponding setter method; this method exists so that the nested
  +     * tag classes can obtain the actual bean name derived from other
  +     * attributes of the tag.
  +     */
  +    public String getBeanName() {
  +
  +        return beanName;
  +
  +    }
   
   
       /**
  
  
  
  1.7       +5 -5      
jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedPropertyHelper.java
  
  Index: NestedPropertyHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedPropertyHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NestedPropertyHelper.java 13 Mar 2002 13:13:28 -0000      1.6
  +++ NestedPropertyHelper.java 10 Aug 2002 02:00:38 -0000      1.7
  @@ -222,7 +222,7 @@
       
       String nameTemp = null;
       if (namedTag instanceof FormTag) {
  -      nameTemp = ((FormTag)namedTag).getName();
  +      nameTemp = ((FormTag)namedTag).getBeanName();
       } else if (namedTag instanceof NestedParentSupport) {
         nameTemp = ((NestedParentSupport)namedTag).getName();
       }
  
  
  
  1.6       +5 -5      
jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedFormTag.java
  
  Index: NestedFormTag.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedFormTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NestedFormTag.java        29 Mar 2002 21:49:09 -0000      1.5
  +++ NestedFormTag.java        10 Aug 2002 02:00:38 -0000      1.6
  @@ -101,7 +101,7 @@
   
       /* set the details */
       HttpSession session = (HttpSession)pageContext.getSession();
  -    NestedReference nr = new NestedReference(getName(), getNestedProperty());
  +    NestedReference nr = new NestedReference(getBeanName(), getNestedProperty());
       NestedPropertyHelper.setIncludeReference(session, nr);
   
       /* continue */
  
  
  

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

Reply via email to