Reputation:
If I have this code in a .java file
for (int i = 0; i < person.getFamilyMembers().get(0).getCount(); i++) {
out.println(person.getFamilyMembers().get(0).getMember().get(i).getLastName()
+ "<br />");
}
Where getFamilyMembers()
returns an ArrayList<FamilyMembers>
and getCount()
returns and int
How do I go about putting this in a JSP with JSTL/EL? I know how to do a foreach on a simple Collection, but this is obviously more involved.
Thanks
Upvotes: 0
Views: 1970
Reputation: 10580
Since your purpose is display the LastName
of each Member
of the first FamilyMember
of the Person
, I would just go with:
<c:forEach var="m" items="${person.familyMembers[0].member}">
${m.lastName}
</c:forEach>
Upvotes: 2