JSF h:CommandButton不适用于f:ajax?

时间:2013-03-27 22:33:07

标签: jsf ajax4jsf

我正在尝试使用以下代码提交表单,但它不会填充bean中的字段:

//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

1 个答案:

答案 0 :(得分:2)

默认情况下,f:ajax只会执行@this,这意味着它只会提交操作按钮,而不会提交表单中输入的任何值。试试这个:

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

请参阅javadoc执行部分:

  

...如果指定了文字,则ids必须以空格分隔。任何一个   关键字“@this”,“@ form”,“@ all”,“@ none”可以在id中指定   名单。如果未指定,则假定为“@this”的默认值。对于   例如,@ this clientIdOne clientIdTwo。

相关问题