JSF h:CommandButton不能与f:ajax一起使用吗? [英] JSF h:CommandButton don't work with f:ajax?
本文介绍了JSF h:CommandButton不能与f:ajax一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用以下代码提交表单,但它不会填充Bean中的字段:
I am trying to submit a form with the following code but it doesn't populate the fields in the bean:
//input above
<h:commandButton actionListener="#{transferenciaVagaBean.search()}" value="Search">
<f:ajax render="@form"/>
</h:commandButton>
Althoug,如果我将组件更改为:
Althoug, if I change the component to:
//input above
<a4j:commandButton actionListener="#{transferenciaVagaBean.search()}"
value="Search"
render="@form" />
效果完美.我使用h:commandButton做错了吗?
It works perfect. Am I doing something wrong using h:commandButton?
我曾尝试从actionListener
更改为action
,因为在此之前我遇到了问题,但在h:commandButton
上却不管用.
I tried to change from actionListener
to action
since I had problems before with this, but it didn't work either way with h:commandButton
.
推荐答案
默认情况下,f:ajax
将仅执行@this
,这意味着它将仅提交操作按钮,而不提交表单中的任何输入值.试试这个:
By default, the f:ajax
will only execute @this
meaning it will only submit the action button, not any of the values of inputs in the form. Try this:
...
<f:ajax execute='@form' render='@form' />
...
查看全文