title: How to display values of type 'UserDefinedClass' into jsp from HashMap<String, UserDefinedClass> using JSTL?
body: <p>Here's is the simplified version of my problem, framework is Spring MVC 3.1 and the view is JSP.</p>
  
  <p>Simple POJO Class: </p>
  
  <pre><code>class User {
  String userId ;
  String userName;
  String age;
   // getters and setters of the above.
  }
  </code></pre>
  
  <p>Controller class: </p>
  
  <pre><code>@Controller
  @SessionAttributes(value = {"userObj", "userMap"})
  class UserController {
  HashMap&lt;String, User&gt; userMap = new HashMap&lt;String, User&gt;();
  
  User demoUser = new User();
  demoUser.setUserId("1");
  demoUser.setUserName("myname");
  demoUser.setAge("45");
  
  userMap.put(demoUser.getUserId, demoUser);
  
  session.setAttribute("userObj", demoUser);
  session.setAttribute("userMap", userMap);
  
  
  //adding this objects to a ModelMap object named 'model'
  model.addAttribute("userMap", userMap);
  model.addAttribute("userObj", demoUser);
  
  
  return "viewName" ; // name resolved to a jsp page.
  }
  </code></pre>
  
  <p>In JSP :</p>
  
  <pre><code>&lt;form:form method="POST" commandName="userMap" name="statusForm"&gt;   
  
  
  &lt;table class="border1"&gt;   
    &lt;tr&gt; 
          &lt;th width=5px&gt;USER ID&lt;/th&gt;      
          &lt;th width=15px&gt;USER &lt;br&gt;Name&lt;/th&gt;
          &lt;th width=5px&gt;USER AGE&lt;/th&gt;
  
    &lt;/tr&gt;
  
      &lt;c:forEach var="entry" items="${userMap}" varStatus="status"&gt;
  
      &lt;tr&gt;
  
          &lt;td&gt; ${entry.key} &lt;/td&gt;   &lt;!--  key alone will get displayed if I comment the 'entry.values' iteration forEach loop--&gt;
  
              &lt;c:forEach var="innerLoop" items ="${entry.value}" varStatus="valuestatus"&gt;   
  
                  &lt;td&gt;${innerLoop}&lt;/td&gt;       
  
              &lt;/c:forEach&gt;
  
      &lt;/tr&gt;
  
      &lt;/c:forEach&gt;
  
  &lt;/table&gt; 
  
  &lt;/form:form&gt;
  </code></pre>
  
  <p>While reaching the inner forEach loop I get a servlet error saying " Don't know how to iterate over supplied items in forEach". If I comment the second forEach loop, the map displays the keys alone.
  I've tried many combinations, nothing seems to be working to display the values inside the HashMap. Please advise. Thanks!</p>