I've found that I'm starting to get the following pattern throughout my
jsps.

 

<bean:size property="contacts" id="numContacts"/>

<% Integer lastContact = new Integer(numContacts.intValue() - 1); %>

 

I'm mostly using this within an iterator to determine whether I'm currently
processing the last element of a collection as is described below.

 

            <logic:iterate property="contacts" id="member"
type="example.ui.busobj.Member" indexId="memberNumber">

                        < logic:write
property="member.name"/><logic:lessThan property="memberNumber"
value="<%=lastContact.toString()%>">, </logic:lessThan>

            </ logic:iterate>

 

I was wondering if it makes sense to add an additional attribute to the size
tag which controls whether the value is a true size, versus the index of the
last element (i.e. one based versus zero based)?

 

Thanks for your feedback,

Heath

 

Reply via email to