The loop assigns each successive item to the value you give.
So for each iteration (item in the list) it will try to call:
setCurrentMember(Member member)
You need to provide such a member and set/get methods in Java:
private currentMember;
Then inside the loop you can refer to it using prop notation:
${currentMember.name}
Cheers,
Nick.
Angelo Chen wrote:
Hi,
I searched list for a while and can't find solution to this, so will just
post it here:
I have an ArrayList of a class and I need to access it from the loop, here
is the code in java:
public class Member {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Member() {
this.name = "member";
}
}
private ArrayList newMembers = new ArrayList();
public ArrayList getNewMembers()
{
return newMembers;
}
public Member getCurrentMember(int index)
{
return (Member)newMembers.get(index);
}
here is the template, it seems not right:
<t:loop source="NewMembers" value = "CurrentMember" index="i" >
// how to display the name of each member here ?
</t:loop>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]