title: Using java.util.Map in h:dataTable
body: <p>I need to display <code>Map</code> using <code>&lt;h:dataTable&gt;</code>. My backing bean has a <code>Map</code> property as below:</p>
  
  <pre><code>public class Bean {
  
      private Map&lt;Integer,String&gt; map; // +getter
  
      @PostConstruct
      public void init() {
          map = new TreeMap&lt;Integer,String&gt;();
          map.put(1,"Sasi");
          map.put(2,"Pushparaju");
          map.put(3,"Venkat Raman");
          map.put(3,"Prabhakaran");
      }
  
  }
  </code></pre>
  
  <p>Then in JSF page I am trying to bind this <code>Map</code> property to the <code>value</code> attribute of <code>&lt;h:dataTable&gt;</code>.</p>
  
  <pre><code> &lt;h:dataTable border="1" value="#{bean.map}" var="map"&gt;
      &lt;h:column id="column1"&gt;
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="UserId"&gt;&lt;/h:outputText&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{map.getKey}"&gt;&lt;/h:outputText&gt;
      &lt;/h:column&gt;
      &lt;h:column id="column2"&gt;
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="Email Id"&gt;&lt;/h:outputText&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{map.getValue}"&gt;&lt;/h:outputText&gt;
      &lt;/h:column&gt;
  &lt;/h:dataTable&gt;
  </code></pre>
  
  <p>It is giving en error that <code>getKey</code> and <code>getValue</code> is not present. I can understand that this is not the correct way to do it. How can I present a <code>Map</code> using <code>&lt;h:dataTable&gt;</code>?</p>