I have a Hashtable<Integer, Sport> called sportMap and a list of sportIds (List<Integer> sportIds) from my backing bean. The Sport object has a List<String> equipmentList. Can I do the following using the unified EL to get the list of equipment for each sport?
<h:dataTable value="#{bean.sportIds}" var="_sportId" >
<c:forEach items="#{bean.sportMap[_sportId].equipmentList}" var="_eqp">
<h:outputText value="#{_eqp}"></h:outputText>
<br/>
</c:forEach>
</h:dataTable>
I get the following exception when trying to run this JSP code.
15:57:59,438 ERROR [ExceptionFilter] exception root cause javax.servlet.ServletException: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>Here's a print out of my environment
Server: JBossWeb/2.0.1.GA Servlet Specification: 2.5 JSP version: 2.1 JSTL version: 1.2 Java Version: 1.5.0_14
Note: The following does work using a JSF tag. It prints out the list of equipment for each sport specified in the list of sportIds.
<h:dataTable value="#{bean.sportIds}" var="_sportId" >
<h:outputText value="#{bean.sportMap[_sportId].equipmentList}">
</h:outputText>
</h:dataTable>
I would like to use the c:forEach tag. Does anyone know if this is possible? If not, anyone have suggestions? In the end I want a stacked list instead of the comma seperated list provided by equipmentList.toString(); (Also, don't want to override toString()).