title: How to iterate a map in JSP?
body: <p>How to iterate map with <code>&lt;Integer, List&lt;ResponseInfo&gt;&gt;</code> in JSP using <a href="https://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/c/forEach.html" rel="nofollow noreferrer"><code>&lt;c:forEach&gt;</code></a> JSTL tag and then iterating that list using another <em>for</em> loop?</p>
  
  <p>Let me know if you want to see the code.</p>
  
  <p>From the controller I'm returning<br>
  <code>return new ModelAndView("reviewAudit","responseForm",responseForm);</code></p>
  
  <p>where <em>responseForm</em> contains a map:<br>
  <code>private Map&lt;String, List&lt;ResponseInfo&gt;&gt; resInfoMap;</code></p>
  
  <p><br>
  Here is my JSP code:</p>
  
  <pre><code>&lt;div class="panel-body"&gt;
      &lt;div class="panel-group" id="accordion"&gt;
      &lt;c:forEach items="${responseForm.resInfoMap}" var="responselist"&gt;
  
          &lt;div class="panel panel-primary"&gt;
              &lt;div class="panel-heading"&gt;
                  &lt;h4 class="panel-title"&gt;
                      &lt;a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" class=""&gt;Topic1&lt;/a&gt;
                  &lt;/h4&gt;
              &lt;/div&gt;
              &lt;div id="collapseOne" class="panel-collapse collapse in" aria-expanded="true"&gt;
                  &lt;div class="panel-body"&gt;
                      &lt;table&gt;
                          &lt;c:forEach items="${responselist}" var="response1"&gt;
                          &lt;tr&gt;
                              &lt;td&gt;
                                  &lt;p&gt;
                                      &lt;span style="font-size: 13px; font-weight: bold;"&gt;Q:&lt;/span&gt;
                                      ${response1.auditQuestion}
                                  &lt;/p&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;p&gt;
                                      &lt;span style="font-size: 13px; font-weight: bold;"&gt;Ans:&lt;/span&gt;
                                      ${response1.auditResponse}
                                  &lt;/p&gt;
                                  &lt;p&gt;
                                      &lt;span style="font-size: 13px; font-weight: bold;"&gt;Comment:&lt;/span&gt;
                                      ${response1.auditComment}
                                  &lt;/p&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                          &lt;/c:forEach&gt;&lt;!-- list iteration --&gt;
                      &lt;/table&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/c:forEach&gt; &lt;!-- map iteration --&gt;         
      &lt;/div&gt;       &lt;!-- &lt;div class="panel-group" id="accordion"&gt; --&gt;
  &lt;/div&gt;
  </code></pre>