本文介绍了P:CommandLink不适用于ui:repeat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将p:commandLink标记与ui:repeat标记一起使用时,我遇到了一个奇怪的问题!

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

commandLink根本不起作用.

commandLink doesn't work at all .

这是我的xhtml代码:

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>

ActionListener只是测试方法:

the ActionListener is just test method :

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

我尝试c:foreach,但是它给了我相同的结果!

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

任何帮助将不胜感激..

any help will be appreciated ..

推荐答案

将方法签名更改为

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

或将actionListener=...更改为action="...

还查看了 BalusC

动作与动作监听器之间的区别

编辑

将bean的范围更改为View Scope(现在是其Request Scope)

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

并在 h:commandLink/h上阅读项目符号N#4 : BalusC

这篇关于P:CommandLink不适用于ui:repeat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!