> -----Original Message----- > From: ROSSEL Olivier [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 19, 2003 2:15 PM > To: 'Struts Users Mailing List' > Subject: RE: Displaying a collection as comma separated values > > > > <nested:iterate > > property="someCollection" > > indexId="index"> > > <logic:notEqual > > property="index" > > value="0">,</logic:notEqual> > > </nested:iterate> > > . > > > > This should allow you to display commas between each word and > > then a dot. > > I cannot test index against 0. > I need to test it against the size of the collection - 1.
Why? Can you elaborate? Test against index value of 0 will work for collection size of 1, 2, or n. The only problem I can see is if your collection is empty; in which case this technique will result in a dot. You can work around this by testing before iterating. > > How can I easily get that value? Using some Java. <nested:nest property="someProperty"/> <nested:define id="theCollection" property="someCollection"/> <% int sizeMinusOne == theCollection.size() - 1; %> <nested:iterate property="someCollection" indexId="index"> <logic:notEqual property="index" value="<%=sizeMinusOne%>">,</logic:notEqual> </nested:iterate> . </nested:nest> > > This sounds a bit weird :-) Yes > Sri --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]