Note that there are some explanatory texts on larger screens.

plurals
  1. POCan I use a Hashtable in a unified EL expression on a c:forEach tag using JSF 1.2 with JSP 2.1?
    text
    copied!<p>I have a Hashtable&lt;Integer, Sport> called sportMap and a list of sportIds (List&lt;Integer> sportIds) from my backing bean. The Sport object has a List&lt;String> equipmentList. Can I do the following using the unified EL to get the list of equipment for each sport?</p> <pre><code>&lt;h:dataTable value="#{bean.sportIds}" var="_sportId" &gt; &lt;c:forEach items="#{bean.sportMap[_sportId].equipmentList}" var="_eqp"&gt; &lt;h:outputText value="#{_eqp}"&gt;&lt;/h:outputText&gt; &lt;br/&gt; &lt;/c:forEach&gt; &lt;/h:dataTable&gt; </code></pre> <p>I get the following exception when trying to run this JSP code.</p> <pre> 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 &amp;lt;forEach&amp;gt;</pre> <p>Here's a print out of my environment</p> <pre> Server: JBossWeb/2.0.1.GA Servlet Specification: 2.5 JSP version: 2.1 JSTL version: 1.2 Java Version: 1.5.0_14 </pre> <p>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. </p> <pre><code>&lt;h:dataTable value="#{bean.sportIds}" var="_sportId" &gt; &lt;h:outputText value="#{bean.sportMap[_sportId].equipmentList}"&gt; &lt;/h:outputText&gt; &lt;/h:dataTable&gt; </code></pre> <p>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()).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload