Return-Path: Delivered-To: apmail-jakarta-struts-dev-archive@apache.org Received: (qmail 96143 invoked from network); 4 Jan 2003 09:46:58 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 4 Jan 2003 09:46:58 -0000 Received: (qmail 24813 invoked by uid 97); 4 Jan 2003 09:48:20 -0000 Delivered-To: qmlist-jakarta-archive-struts-dev@jakarta.apache.org Received: (qmail 24772 invoked by uid 97); 4 Jan 2003 09:48:19 -0000 Mailing-List: contact struts-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list struts-dev@jakarta.apache.org Received: (qmail 24760 invoked by uid 98); 4 Jan 2003 09:48:18 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <3E16AD99.3060901@apache.org> Date: Sat, 04 Jan 2003 04:47:05 -0500 From: Ted Husted Organization: Apache Software Foundation - Jakarta Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Struts Developers List Subject: Re: [PATCH] Beta 1.3 pulls tag values from wrong bean References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N The general Bugzilla page is wrong in our case (been meaning to fix that). We prefer that patches be attached to Bugzilla issues so that they dont' get buried on the list =:0) -Ted. David Morris wrote: > I located the source of the problem, which is caused > by a change to the nested tags. The code causing the error is this block > found in the NestedPropertyHelper.getNestedNameProperty method. > > The name property for any tag that extends > org.apache.struts.taglib.html.BaseFieldTag > is initialized to a constant value of > Constants.BEAN_KEY. That means the test for > null is never met so the innermost nested > tag's (which is the nested:text tag in this case) > name is used in some cases. > > Removing this code should fix my case, but > I suspect that there was a reason for this > change, which was made shortly after beta 2 > was released. Here is a patch that is less > drastic than the removal. This patch makes > the minimal change, but there are still cases > in the existing code where errors are not > dealt with that should probably be fixed. > > The bugzilla page says to send a patch rather > to the developer list so here is one. > > David Morris > > > ------------------------------------------------------------------------ > > Index: NestedPropertyHelper.java > =================================================================== > RCS file: /home/cvspublic/jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedPropertyHelper.java,v > retrieving revision 1.11 > diff -u -r1.11 NestedPropertyHelper.java > --- NestedPropertyHelper.java 16 Nov 2002 07:07:07 -0000 1.11 > +++ NestedPropertyHelper.java 4 Jan 2003 07:14:13 -0000 > @@ -65,6 +65,7 @@ > import javax.servlet.jsp.tagext.Tag; > > import org.apache.struts.taglib.html.FormTag; > +import org.apache.struts.taglib.html.Constants; > > /** A simple helper class that does everything that needs to be done to get the > * nested tag extension to work. Knowing what tags can define the lineage of > @@ -211,11 +212,17 @@ > Tag namedTag = (Tag)tag; > > // see if we're already in the right location > + String defaultName = null; > if (namedTag instanceof NestedNameSupport) { > String name = ((NestedNameSupport)namedTag).getName(); > - // return if we already have a name > + // return if we already have a name and not just default > if (name != null) { > - return name; > + if (name.equals(Constants.BEAN_KEY)) { > + defaultName = name; > + } > + else { > + return name; > + } > } > } > > @@ -228,7 +235,11 @@ > !(namedTag instanceof NestedParentSupport) ); > > if (namedTag == null) { > - // need to spit some chips > + // Return default name because parent is not more specific. > + if (defaultName != null) { > + return defaultName; > + } > + // need to spit some chips > } > > String nameTemp = null; > > > > ------------------------------------------------------------------------ > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: -- Ted Husted, Struts in Action -- To unsubscribe, e-mail: For additional commands, e-mail: