2012-07-17 34 views
1

當標籤與ui:repeat標籤一起使用時,我遇到了一個奇怪的問題!P:CommandLink不適用於ui:重複

commandLink根本不起作用。

這是我的XHTML代碼:

<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的只是測試方法:

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

我嘗試c:foreach,但它給了我同樣的結果!

任何幫助將不勝感激..

+0

範圍到視圖範圍(因爲現在它的請求範圍)

而且讀子彈N#4爲了調試目的,將''放在頁面中,您將看到發生了任何錯誤。我也會刪除''並將它放在''中作爲一個數值參數 – 2012-07-17 09:46:28

+0

我已經有並且沒有錯誤信息出現! 我刪除了 2012-07-17 10:34:16

+0

btw刪除了空的'oncomplete =「'' – Daniel 2012-07-17 11:03:17

回答

2

更改方法簽名改成

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

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

也看看以下的答案必須由BalusC

Differences between action and actionListener


編輯

改變你的bean的在h:commandLink/h:commandButton is not being invoked通過BalusC

+0

thnaks daniel,但我試過所有這些,我的問題不是隻與commandLink」as它工作正常,如果我把它放在標籤「當問題出現在UI裏面的commandLink渲染:重複! – 2012-07-17 10:36:04

+0

什麼範圍是你的'bussinessOwnerViewerMB'豆? – Daniel 2012-07-17 11:04:42

+0

我的bean的範圍是請求範圍.. – 2012-07-17 11:17:14