You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Tom Klaasen (TeleRelay)" <to...@telerelay.com> on 2001/11/06 09:23:31 UTC

RE: [PATCH] nested iterates and the indexed attribute

Hi Dave,

First my excuses for responding this late. The 1st of November is a
public holiday here in Belgium, and I've took the opportunity to
prolongue the weekend a bit :-)

And you're right about the name==null case, so here's a patch for that
(against current cvs). I still haven't used every possible combination
of tags in struts ;-), that's probably why I overlooked it.

I've also thought about adding a check for (iterateTag.getId() != null)
in the while loop, but this isn't supposed to happen anyway (id is a
required attribute for iterate). So in the philosophy "if something is
wrong, let it be obvious that it goes wrong", I didn't add this check.

Thank you for your feedback,
tomK


> -----Original Message-----
> From: dhay@lexmark.com [mailto:dhay@lexmark.com] 
> Sent: woensdag 31 oktober 2001 22:00
> To: Struts Developers List
> Subject: Re: [PATCH] nested iterates and the indexed attribute
> 
> 
> 
> 
> Hi Tom,
> 
> apologies - I didn't read your initial note thoroughly enough 
> - I thought you
> were submitting a patch to allow for nested iterates, not 
> just fixing the
> problem of using an outer iterate param in the inner iterate. 
>  You can ignore my
> comments for that case!
> 
> Have looked at your patch, and it will fail if name=null when 
> the prepareIndex
> method is called.  This is the case with some of the tags eg 
> button, and submit
> (and img and image changes which I am about to submit).
> 
> Could you add a check for this?
> 
> Cheers,
> 
> Dave
> 
> 
> 
> 
> 
> "Tom Klaasen (TeleRelay)" 
> <to...@interlock.lexmark.com> on
> 10/31/2001 11:47:09 AM
> 
> Please respond to "Struts Developers List"
>       <st...@interlock.lexmark.com>
> 
> To:   "Struts Developers List"
>       <st...@interlock.lexmark.com>
> cc:    (bcc: David Hay/Lex/Lexmark)
> Subject:  [PATCH] nested iterates and the indexed attribute
> 
> 
> 
> In case the answer is positive ("yes, this is a bug and not expected
> behaviour"), I hereby attach a patch to solve it.
> 
> Tested with the html:radio tag, and it should work for all tags that
> extend BaseHandlerTag (which, I presume but did not check, will be all
> tags that can be indexed)
> 
> Let me know what you think about it,
> 
> tomK
> 
> 
> > -----Original Message-----
> > From: Tom Klaasen (TeleRelay)
> > Sent: woensdag 31 oktober 2001 17:09
> > To: Struts Developers List
> > Subject: nested iterates and the indexed attribute
> >
> >
> > Hi all,
> >
> > I think I discovered a bug in struts (nightly build 20011018):
> >
> > when I use nested iterates, the indexed attribute is always
> > referring to
> > the innermost iterate index, not the one which name is specified.
> >
> > so when I do
> >
> > <logic:iterate id="beanprop" name="bean" property="props">
> >    <logic:iterate id="beanpropinner" name="beanprop"
> > property="inner">
> >         <html:radio name="beanprop" property="someIndex"
> > value="someValue" indexed="true"/>
> >    </logic:iterate>
> > </logic:iterate>
> >
> > I get something like
> >
> > <input type="radio" name="beanprop[0].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> > <input type="radio" name="beanprop[2].someIndex" value="someValue">
> > <input type="radio" name="beanprop[0].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> > <input type="radio" name="beanprop[2].someIndex" value="someValue">
> > <input type="radio" name="beanprop[3].someIndex" value="someValue">
> > <input type="radio" name="beanprop[4].someIndex" value="someValue">
> >
> > instead of the expected
> >
> > <input type="radio" name="beanprop[0].someIndex" value="someValue">
> > <input type="radio" name="beanprop[0].someIndex" value="someValue">
> > <input type="radio" name="beanprop[0].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> > <input type="radio" name="beanprop[1].someIndex" value="someValue">
> >
> > (watch the indexes)
> >
> > (Of course, "someValue" would be replaced by something that
> > is computed
> > and makes more sense. This computation is omitted here for 
> simplicity)
> >
> > Now, should I in fact consider this a bug and try to solve 
> this, or do
> > you think this is expected behaviour?
> >
> >
> > thanks,
> > tomK
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-dev-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
> >
>