grnmachine
asked on
How to loop through list in jsp using for each and retrieve its properties
Hi, I am having trouble understanding how to retrieve properties out of a collection for display in my jsp page.
I am retrieving a list that is Iterable<company> then putting it into a list in my backing bean
here is the code that is in my backing bean to establish the company name
Here is the JSP snippet
This of course isn't working, but I'm not sure what exactly I need to do to get these properties out of the list to use in the header.
Could someone please shed some light on this? Thanks!
I am retrieving a list that is Iterable<company> then putting it into a list in my backing bean
here is the code that is in my backing bean to establish the company name
List<Company> companyFullName = Lists.newArrayList();
Iterable<Company> owner = Lists.newArrayList();
owner = this.groups.owners().activeAsOf(new YearMonth(this.getMonth())).list();
for(Company company: owner){
companyFullName.add(company);
}
super.getContext().putIntoRequest("companyFullName",companyFullName);
Here is the JSP snippet
<c:forEach items="${requestScope.companyFullName}" var="currentCompany" varStatus="loop">
<div class="companyAccordion">
<h3>
${currentCompany.codeName} - ${currentCompany.commonName}
</h3>
<div>
<div class="panelContent"></div>
</div>
</div>
</c:forEach>
This of course isn't working, but I'm not sure what exactly I need to do to get these properties out of the list to use in the header.
Could someone please shed some light on this? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER