title: How to display many to many jpa collection in jsf?
body: <p>i made many to many join table between users and groups tables .
  so i have a collection in each entitie ( Users and groups )</p>
  
  <pre><code>@ManyToMany(mappedBy = "usersCollection")
      private Collection&lt;Groups&gt; groupsCollection;
  </code></pre>
  
  <p>and i want to display groups collection in Jsf thats what i did :</p>
  
  <pre><code>&lt;p:dataTable var="user" value="#{usergestion.tableusers}"&gt;  
                             &lt;p:column headerText="username"&gt;  
                                 &lt;h:outputText value="#{user.username}" /&gt;  
                             &lt;/p:column&gt;  
  
                             &lt;p:column headerText="nom"&gt;  
                                 &lt;h:outputText value="#{user.nom}" /&gt;  
                             &lt;/p:column&gt;  
  
                             &lt;p:column headerText="prenom"&gt;  
                                 &lt;h:outputText value="#{user.prenom}" /&gt;  
                             &lt;/p:column&gt;
  
                              &lt;p:column headerText="groupe"&gt; 
  
                                  &lt;h:outputText value="#{user.groupsCollection.get(0)}"  /&gt;
  
                             &lt;/p:column&gt;
  </code></pre>
  
  <p>and that what i get :
  <img src="https://i.stack.imgur.com/aicrq.png" alt="enter image description here"></p>
  
  <p>how i can get just the nombre not com.database.Groups[ idGroups=2 ]  ???</p>
  
  <p><strong>Solution :</strong></p>
  
  <p>i used : <code>&lt;h:outputText value="#{user.groupsCollection.get(0).groupname}"  /&gt;</code></p>