Hi Mike Thats easy.
Outer loop needs to specify the "indexId" parameter as in: <logic:iterate name="applicationForm" property="familymembers" id="familymmber" type="application.FamilyMember" indexId="memberIndex"> Then you can use whatever inner loop (or loops) you want. <logic:iterate something else....> Inside here you can refer to the 'memberIndex' as in: <html:text name="familymembers[${memberIndex}].forename"> HTH Cheers mc On 29 Oct 2005 at 15:29, Mike Manley wrote: > Thanks for that - but I think I've not explained my problem properly. > > The problem is that the bean containing the data is NOT the one in the > inner loop but the bean iterated through in the outer loop: > > <logic:iterate name="applicationForm" property="familymembers" > id="familymmber" type="application.FamilyMember"> > > I want to be able to access as from within the inner loop. > familymembers[0].surname, familymembers[0].forename, > familymembers[1].surname, etc. > > The reason for this is that the form needs to show and allow editing of > different data depending on who is accessing it. Yeah, I know it makes > things complicated but it's what THEY want. The inner iterate is around > a form configuration bean which describes the data which should be > displayed: > > <logic:iterate name="applicationForm" property="familyItems" > id="formItem" type="utils.InputItem"> > > InputItem has fields which describe the type of input field to be used > and whether it is displayed, readonly, mandatory, etc. > > i.e. inputitem is an array with entries something like - there are other > fields to hold any option lists for select items, etc. but those aren't > really relevant to this problem. > inputitem[0] > property=surname > readonly=false > size=30 > type=text > mandatory=true > > inputitem[1] > property=forename > readonly=false > size=30 > type=text > mandatory=true > > and I want to end up with html like this. > > <!-- First Row --> > <input type="text" name="familymembers[0].forename" value=""> > <input type="text" name="familymembers[0].surname" value=""> > <!-- 2nd row --> > <input type="text" name="familymembers[1].forename" value=""> > <input type="text" name="familymembers[1].surname" value=""> > > but because the iterator count is picked up from the inner loop - I end > up with > <!-- First Row --> > <input type="text" name="familymembers[0].forename" value=""> > <input type="text" name="familymembers[1].surname" value=""> > <!-- 2nd row --> > <input type="text" name="familymembers[0].forename" value=""> > <input type="text" name="familymembers[1].surname" value=""> > <!-- 3rd row --> > <input type="text" name="familymembers[0].forename" value=""> > <input type="text" name="familymembers[1].surname" value=""> > > > I've done this successfully using a similar technique when there is a > single data item to be edited but this form needs to be able to edit > multiple rows at once and I'm hitting a problem with the iterator. > > I guess what I really need is a way to iterate round the inner loop > without the counter used for indexing being increased. > > Again, thanks for any help anyone can give. > > Mike > > Murray Collingwood wrote: > > Hi Mike > > > > Maybe I'm simplifying it somewhat and I'm not sure of your form-bean > > structure, > > however the outer loop should loop through 'familymembers' as it is looping > > it should > > set a form-bean for the inner loop identifying a 'familymember'. I also > > like to add the > > type here - helps my inline documentation. So, outer loop should be: > > > > <logic:iterate name="applicationForm" property="familymembers" id="familymember" > > type="controller.form.FamilyMemberForm"> > > > > Then we can add the inner loop in a similar manner, referencing the > > 'familymember' > > defined in the outerloop: > > > > <logic:iterate name="familymember" id="familyitem" > > type="controller.form.FamilyItemForm"> > > > > Finally we can then display the input box for these items: > > > > <html:text name="familyItem" property="dataProperty" > > size="${familyItem.size}" > > readonly="${familyItem.readonly}"> > > > > Maybe this is too simplistic, sorry if I've missed the point somewhere. > > > > Kind regards > > mc > > > > > > On 28 Oct 2005 at 14:01, Mike Manley wrote: > > > > > >>Hi, > >> > >>I have a problem trying to create a multi row edit form which has to be > >>able to dynamically decide which columns should be displayed for edit. > >>My jsp uses the code below. > >> > >> <logic:iterate name="applicationForm" property="familymembers" > >>id="familymembers"> > >> <tr> > >> <logic:iterate name="applicationForm" property="familyItems" > >>id="formItem"> > >> <td> > >> <logic:notEmpty name="formItem"> > >> <% InputItem inputItem = (InputItem)formItem; %> > >> <logic:equal name="formItem" property="type" > >>value="text"> > >> <html:text size="<%= inputItem.getSize() %>" > >>readonly="<%= inputItem.isReadonly()%>" name="familymembers" > >>property="<%= inputItem.getDataProperty() %>" indexed="true"/> > >> </logic:equal> > >> </td> > >> </logic:iterate> > >> </td> > >> </logic:iterate> > >> > >>The outer iterate is the bean holding the data - in this case a list of > >>family members - name, gender, date of birth. The inner iterate is the > >>list of fields to be displayed for each, My problems is that when this > >>is rendered as html - the index values generated use the index of the > >>inner iterate not the outer one - so I get > >> > >><tr> > >><td> > >> <input type="text" name="familymembers[0].forename" value=""> > >></td> > >><td> > >> <input type="text" name="familymembers[1].surname" value=""> > >></td> > >></tr> > >><tr> > >><td> > >> <input type="text" name="familymembers[0].forename" value=""> > >></td> > >><td> > >> <input type="text" name="familymembers[1].surname" value=""> > >></td> > >></tr> > >> > >>whereas what I want is > >> > >><tr> > >><td> > >> <input type="text" name="familymembers[0].forename" value=""> > >></td> > >><td> > >> <input type="text" name="familymembers[0].surname" value=""> > >></td> > >></tr> > >><tr> > >><td> > >> <input type="text" name="familymembers[0].forename" value=""> > >></td> > >><td> > >> <input type="text" name="familymembers[1].surname" value=""> > >></td> > >></tr> > >> > >>I have also tried using nested:iterate as well - in which case I get > >> > >><tr> > >><td> > >> <input type="text" name="applicationForm[0].familymembers[0].forename" > > > > value=""> > > > >></td> > >><td> > >> <input type="text" name="applicationForm[1].familymembers[0].surname" > > > > value=""> > > > >></td> > >></tr> > >><tr> > >><td> > >> <input type="text" name="applicationForm[0].familymembers[1].forename" > > > > value=""> > > > >></td> > >><td> > >> <input type="text" name="applicationForm[1].familymembers[1].surname" > > > > value=""> > > > >></td> > >></tr> > >> > >>so the familymembers index is now correct but I have an additionally > > > > applicationForm[0] that I don't need. > > > >>Basically what I want to achieve is that the inner loop is ignored for the > >>purposes of > > > > generating the indexing for the html output - but can't figure out to > > achieve that without > > writing my own tag. > > > >>Can anyone help? > >> > >>Thanks > >> > >>Mike Manley > >> > >> > >> > >> > >> > >> > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > >>-- > >>No virus found in this incoming message. > >>Checked by AVG Free Edition. > >>Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005 > >> > > > > > > > > > > FOCUS Computing - web design > > Mob: 0415 24 26 24 > > [EMAIL PROTECTED] > > http://www.focus-computing.com.au > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.362 / Virus Database: 267.12.6/151 - Release Date: 28/10/2005 > FOCUS Computing - web design Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com.au -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.12.6/151 - Release Date: 28/10/2005 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]