2013-03-27 80 views
0

我試圖提交表單用下面的代碼,但它不填充字段在bean:JSF h:CommandButton不適用於f:ajax?

//input above 
<h:commandButton actionListener="#{transferenciaVagaBean.search()}" value="Search"> 
    <f:ajax render="@form"/> 
</h:commandButton> 

Althoug,如果我改變了組件:

//input above 
<a4j:commandButton actionListener="#{transferenciaVagaBean.search()}" 
        value="Search" 
        render="@form" /> 

它的工作原理完善。我用h:commandButton做錯了什麼?

我試圖從actionListener更改爲action,因爲我在此之前遇到過問題,但它不能以h:commandButton的任何方式工作。

回答

2

默認情況下,f:ajax將只執行@this這意味着它只會提交操作按鈕,而不是表單中任何輸入值。試試這個:

... 
<f:ajax execute='@form' render='@form' /> 
... 

javadoc執行部分:

...如果指定文字的ID必須是空格分隔。可在 列表中指定 關鍵字「@this」,「@form」,「@all」,「@none」。如果未指定,則假定「@this」的默認值。例如,對於 示例,@ this clientIdOne clientIdTwo。

+0

OMG。那很簡單。謝謝! – Migore 2013-03-27 22:41:26