Thanks for the reply, appreciate it. From what I understand, I have to do something like :
firstList --eachElementIs--> simpleBean --contains--> secondList In other words, wrap the 2nd list inside a bean. However, if that's the cast, I would imagine it will drag down the performance of our application by quite a bit due to Objects instantiation. (the 2D collection get used a lot and the collections are quite large). Is there anyway around it so that I can still use the original data structure ? Again, thanks for the input. :) -----Original Message----- From: Arron Bates [mailto:struts-user@;keyboardmonkey.com] Sent: Tuesday, November 12, 2002 4:51 PM To: Struts Users Mailing List Subject: Re: 2D Collection and nested:iterate The problem is the use of "this/" as the property of the second iterate. Basically, it's basically saying "don't append anything more to the property reference, my parent's reference will do". ie: you're probably after "myProperty[5][6]" but the "this/" is telling it to leave it at "myProperty[5]" never getting that next index. Truly multi-dimensional workings to the property constructors isn't an ability of BeanUtils as yet. It's interesting and may work its way into things in the future, but for now it's not there. So... what you'll have to do now is make the simplest of beans hold onto the second ArrayList and access it via a property so it has the full... firstList[5].secondList[6] ..nested property. The bean doesn't have to do anything special, just hold onto that array list so BeanUtils can get at the nested bean properly. Arron. On Wed, 2002-11-13 at 08:20, Louis Leung wrote: > Hi all, > > > > In my action form there is a 2D collection, both used ArrayList. (i.e. > An ArrayList whose elements are ArrayList also) I want to retrieve data > (which are all String) from the 2nd layer of the 2D collection using > <nested:text ...> tag so that it can populate the value back > automatically. However, it is not working. > > > > Code in jsp : > > > > <nested:form ...> > > > > <nested:iterate id="row" property="A"> > > <tr> > > <nested:iterate id="column" property="this/"> > > <td> > > <% System.out.println(column); %> > > <nested:text property="this/" > indexed="yes"/> <!-putting indexed="yes" or not doesn't change the > result abit--> > > </td> > > </nested:iterate> > > </tr> > > </nested:iterate> > > > > </nested:form> > > > > > > > > Result (assume a 2X2 collection with elements A1, A2, B1, B2 in them > already) > > > > 4 textboxes, the top 2 with [A1, A2] for both, and bottom 2 with [B1, > B2] > > System.out prints out A1, A2, B1, B2 separately > > > > > > It seems like the 2nd iterate tag is indeed iterating thru the 2nd layer > of the collection from the System.out statement. But the <nested:text > .../> tag is not retrieving each element of the 2nd layer collection. > Rather, it is using the whole of the 2nd collection itself. > > > > Anyone has any idea why and possibly solution ? I would really like to > use the <nested:text .../> tag so that the values can be automatically > populated back by Struts after the user input. > > > > > > Thanks in advance. > > > > Louis > > > > > -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>