1

I have strange problem with p:commandLink tag when i use it with the ui:repeat tag !

commandLink doesn't work at all .

this my xhtml code :

<h:form>
    <ui:repeat varStatus="miteraionno" value="#{bussinessOwnerViewerMB.bOwner.bOBranches}" var="branch" >

        <div class="details" >       

        <ul class="services">
            <li>
               <p:commandLink actionListener="#{bussinessOwnerViewerMB.testMethod}" styleClass="nav_services" oncomplete="">
                    <h:outputText value="#{branch.branchName}"/>
               </p:commandLink>
            </li>
        </ul>
        </div>
    </ui:repeat>

the ActionListener is just test method :

public void testMethod(){
    System.out.println("BussinessOwnerViewerMB.changeMapListener()");
}

i try c:foreach but it gives me the same result !

any help will be appreciated ..

Petr Mensik
  • 26,874
  • 17
  • 90
  • 115
k.elgohary
  • 403
  • 8
  • 21

1 Answers1

2

Change method signature into

public void testMethod(ActionEvent event){
    System.out.println("BussinessOwnerViewerMB.changeMapListener()");
} 

Or change actionListener=... into action="...

also take a look at following answer by BalusC

Differences between action and actionListener


EDIT

Change the scope of your bean into View Scope (cause now its Request Scope)

And read bullet N#4 at the h:commandLink / h:commandButton is not being invoked by BalusC

Community
  • 1
  • 1
Daniel
  • 36,833
  • 10
  • 119
  • 200
  • thnaks daniel , but i tried al of those , my problem is not with the commandLink only "as it works fine if i put it out of the tag " the problem is appear when the commandLink render inside the ui:repeat ! – k.elgohary Jul 17 '12 at 10:36
  • what scope is your `bussinessOwnerViewerMB` bean ? – Daniel Jul 17 '12 at 11:04
  • change it to view scope (atleast) , read this (bullet N#4 http://stackoverflow.com/a/2120183/617373) – Daniel Jul 17 '12 at 11:21
  • Fantastic .. many thanks Daniel you made my day it works after change the scope to view scope "but i should change all related classes to implement serializable " many thanks :) – k.elgohary Jul 17 '12 at 12:22