2013-11-04 32 views
0

擁有一個帶有ADF的基本JSF項目,它需要從表中刪除一行(每行都是Album),並在請求行旁邊具有刪除按鈕(每一行都有一個)。
使用JDeveloper與ADF嘗試(嘗試這種解決方案也只用簡單的JSF :(How can I pass selected row to commandLink inside dataTable?) 然而,在我看來,setPropertyListenersetPropertyActionListener不調用(把一些虛擬的評論在setCommon()功能,沒見過,也美麗評論從del_action()沒有顯示)也試用@SessionScoped
主要問題:什麼地方出錯,即使價值傳遞不起作用?
任何想法將不勝感激(並缺少語法突出,仍然是一個新手,還沒弄明白:) :)af:setPropertyListener不工作,調用(也不是f:setPropertyActionListener)

JSF部分:

<af:column sortable="false" headerText=" " align="start" id="c4"> 
<h:commandButton value="Delete" id="del" action="#{backing_main.del_action}"> 
    <af:setPropertyListener to="#{backing_main.common}" from="#{row.albumName}" type="action" /> 
</h:commandButton> 
</af:column> 

輔助Bean:

 

    @ManagedBean(name="backing_main") 
    @ViewScoped 

    ... 

    private String common; 
    public void setCommon(String common){ 
     System.out.print("!!!SET!!!!!"); 
     this.common = common; 
    } 

    public String getCommon(){ 
     return this.common; 
    } 

    public void del_action() { 
     System.out.print("!!!!!!!!!!!!!!!!Delete1");  
    } 

    public static class Album{ 

      String artist; 
      String albumName; 
      //constructor, setter, all the expected stuff 
    } 



+0

函數del_action()需要返回一個字符串! –

回答

0

您更好地使用ADF組件得到預期的結果:af:commandButton,而不是h:commmandButton

如果您不使用任務流刪除行,那麼您最好切換到actionListener而不是action

+0

後來我完全重寫了我的程序,並且使用了ADF組件,這就是爲什麼我接受了您的答案。 :) – bittersweet