使用h:commandButton更新和提交Ajax [英] Ajax update and submission using h:commandButton
问题描述
如何使用<h:commandButton>
更新div并进行部分提交,我以前使用<p:commandButton>
通过将ajax属性设置为true并将update属性设置为:statusBlock来进行部分提交,其中<p:commandButton>
上遇到一些设计问题,所以我无法使用它,所以必须使用<h:commandButton>
.
How to update a div and do partial submission using <h:commandButton>
, I have previously used <p:commandButton>
to do partial submission by setting the ajax attribute to true and the update attribute to :statusBlock, where the id of the <h:panelGroup>
is statusBlock. I am having some designing issues with <p:commandButton>
so I cannot use it so I have to use <h:commandButton>
.
推荐答案
This is to be done by nesting a <f:ajax>
in it.
实际上,
<p:commandButton ... process="@form" update=":statusBlock" />
与
<h:commandButton ...>
<f:ajax execute="@form" render=":statusBlock" />
</h:commandButton>
请注意,与PrimeFaces等效项的细微差别在于,PrimeFaces在进程/执行中默认为@form
,而<f:ajax>
一个默认为@this
,因此您可能需要在所有字段中明确指定execute="@form"
没有在PrimeFaces组件中指定process
属性的地方.
Note that the subtle difference with the PrimeFaces equivalent is that PrimeFaces defaults to @form
in the process/execute, while the <f:ajax>
one defaults to @this
, so you might need to explicitly specify execute="@form"
over all place where you didn't specify the process
attribute in the PrimeFaces component.
这篇关于使用h:commandButton更新和提交Ajax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!