问题
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 ..
回答1:
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
来源:https://stackoverflow.com/questions/11519884/pcommandlink-doesnt-work-with-uirepeat