title: p:commandlink inside ui:repeat
body: <p>In our application we are displaying the menus dynamically. We have the menu object(menuitems in below code) populated with all the menu items (read from an xml). The home page then generates the menus by usinng ui:repeat. Insdie ui:repeat there are p:commandlink.
  Below is the code </p>
  
  <pre><code>   &lt;h:form id="mainMenu"&gt;
      &lt;h:panelGroup id="MMPanel" layout="block" styleClass="left_menu"&gt;
          &lt;ui:repeat var="node" value="#{menuitems.level1menus}"&gt;
              &lt;p:commandLink immediate="true" styleClass="menu" 
                  action="#{menuitems.onLevel1MenuChange(node.id)}"
                  update=":pageTitle :menuLevel2 :menuLevel3" title="#{node.name}" 
  
                  rendered="#{menuitems.selectedLevel1.id!=node.id}" onclick="menuSelect(this)"&gt;
                  &lt;span class="icon icon_#{node.name}"&gt;&lt;/span&gt;
                  &lt;span class="text"&gt;#{node.name}&lt;/span&gt;
  &lt;/p:commandLink&gt;
  
                  &lt;p:commandLink immediate="true" styleClass="menu activelink" 
                  action="#{menuitems.onLevel1MenuChange(node.id)}"
                  update=":pageTitle :menuLevel2 :menuLevel3" title="#{node.name}"
  
                  rendered="#{menuitems.selectedLevel1.id==node.id}"  onclick="menuSelect(this)"&gt;
                  &lt;span class="icon icon_#{node.name}"&gt;&lt;/span&gt;
                  &lt;span class="text"&gt;#{node.name}&lt;/span&gt;
      &lt;/p:commandLink&gt;
  
          &lt;/ui:repeat&gt;
          &lt;/h:panelGroup&gt;         
      &lt;/h:form&gt;
  </code></pre>
  
  <p>The menuitems bean is at Session level.
  There are two diffeent p:commandlink inside ui:repeat. The only difference between the 2 is in the styleclass and rendered attribute. This is done to identify the <strong>default</strong> menu item when the user logs for the first time and give it an extra css of "activeLink".
  The java script called on onclick is given below (in case it is required)</p>
  
  <pre><code>    function menuSelect(selectOne){
          $(".left_menu&gt;a").removeClass("activelink");
          $(selectOne).addClass("activelink");
          removeAllChannels();
      }
      function removeAllChannels(){
              $.atmosphere.unsubscribe();
        }
  </code></pre>
  
  <p>The removeAllChannels is to remove primepush autorefresh channels we have.</p>
  
  <p>The issue i am facing is this.
  All the links are getting rendered correctly and in Firebug i see all of them have the same html.
  But the one which is generated with the extra css "activeLink" (through rendered condition -- menuitems.selectedLevel1.id==node.id) is not working. Nothing happens when i click this <strong>default</strong> link. All other links work fine.
  So when i click on a different link, it takes me to the required page. But when i click back on the menu which was default, nothing happens
  I added a Custom phase listener and saw that all the lifecyle stages are called when this link is clicked but the action method is not.
  I went through the links <a href="https://stackoverflow.com/questions/11519884/pcommandlink-doesnt-work-with-uirepeat">this</a> and <a href="https://stackoverflow.com/questions/2118656/hcommandlink-hcommandbutton-is-not-being-invoked/2120183#2120183">this</a> but could not figure out the issue.
  Please help.
  Do tell me if something is not clear</p>