title: How to make a primefaces dynamic toolbar
body: <p>I'm working with PrimeFaces 3.1.1 since last week and it seems to be an excellent visual component framework. I'm doing a migration from Richfaces and trying to get everything working only with Prime and JSF2 (2.1.6 version). </p>
  
  <p>My problem comes with a dynamic toolbar I have to implement. Some of the operations are integrated directly on the toolbar (commandButtons) and other operations have some suboperations inside, so I have to do a menuButton with the operation name and add every single operation here like a menuitem. Here is my code:</p>
  
  <pre class="lang-xhtml prettyprint-override"><code>&lt;h:panelGroup id="Texto_Header" layout="block"&gt;
          &lt;h:form&gt;
              &lt;p:toolbar&gt;
                  &lt;p:toolbarGroup&gt;
                      &lt;!-- Operaciones de aplicación --&gt;
                      &lt;ui:repeat value="#{logedBean._apps}" var="opBean"&gt;
                              &lt;!-- OPERACION PRINCIPAL EJECUTABLE --&gt;
                              &lt;h:panelGroup rendered="#{opBean._Clickable}"&gt;
                                  &lt;p:commandButton ajax="true" value="#{opBean._Nombre}"
                                      action="#{opBean.actionOperationClick}" /&gt;
                              &lt;/h:panelGroup&gt;
                              &lt;!-- OPERACION PRINCIPAL CON SUBOPERACIONES --&gt;
                              &lt;h:panelGroup rendered="#{!opBean._Clickable}"&gt;
                                  &lt;p:menuButton value="#{opBean._Nombre}"&gt;
                                      &lt;ui:repeat value="#{opBean._subOperaciones}" var="opBean2"&gt;
                                          &lt;p:menuitem ajax="true" value="#{opBean2._Nombre}"
                                              actionListener="#{opBean2.actionOperationClick}" /&gt;
                                      &lt;/ui:repeat&gt;
                                  &lt;/p:menuButton&gt;
                              &lt;/h:panelGroup&gt;
                      &lt;/ui:repeat&gt;
                  &lt;/p:toolbarGroup&gt;
              &lt;/p:toolbar&gt;
          &lt;/h:form&gt;
      &lt;/h:panelGroup&gt;
  </code></pre>
  
  <p>My problem is I'm getting only the first operation components, it renders the commandButtons correctly and their actions are working well, however in the case of "#{!opBean._Clickable}" I get a menuButton with the name, but no menuitem inside. It looks like the embeded ui:repeat iteration is not being well done. </p>
  
  <p>I have tried the same chance using <em>c:foreach</em>, <em>c:choose</em> and <em>c:otherwise</em> tags and in this case I get the menus visually well done, commandButton actions are working well too, but when I click in a menuItem it's saying that opBean2 is not recognized... However as I have said before, I prefer to use JSF tags exclusively. Is there a way to do that?</p>