struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Coast <>
Subject RE: The index number of iterate tag
Date Fri, 24 Aug 2001 10:18:20 GMT
<logic:iterate name="myBeanName"  property="myBeanProp" id="indexedBeanName"

this will:
1) iterate over the collection / array obtained by calling 'getMyBeanProp()'
on the bean named 'myBeanName' 
2) place the current element in the iteration in page context against the
name 'indexedBeanName' 
3) place the current index in the page context against the name myIndexName

-----Original Message-----
From: Vincent Lin []
Sent: Friday, August 24, 2001 9:26 AM
Subject: The index number of iterate tag


Could any one tell me how to get the index number in a iterate tag? For
example, I want to show a html table in screen like below. 

No. 	Name.	Address    ......
1	AAA        XXxxxx
2	BBB	xxYyyyy
3	CCC	ffxxxxxx

And I have a collection of objects which have attribute name and address ...
etc. I can use <logic:iterate> to display this collection. But I don't know
how to get the item number number. Now, I use a variable i and use scriptlet
<%= ++i %> in JSP, but I think the codes are ugly. Is there a tag or
implicit variable to get the index number of <logic:iterate> ?


This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper at LevelSeas for the presence of computer viruses.

View raw message