【发布时间】:2013-01-14 13:42:41
【问题描述】:
我正在使用 primefaces mobile(0.9.2 - jsf2),但我遇到了一个奇怪的问题。 我有一个带有 2 个按钮的视图,一个用于添加,另一个用于保存订单。 添加按钮工作正常,但是当我单击保存按钮时,它不是调用保存方法,而是首先进入方法添加,然后进入保存方法。 有人有小费吗? 谢谢。。
...<div class="field-input" >
<p:commandButton action="#{pedidoMobileBean.adicionaProduto()}" id="pcbAdd" value="Adicionar" update="hpgItens hpgTotais hpgTipoBonificacao" icon="plus" iconPos="left" ></p:commandButton>
</div>
<div class="label-input"></div>
<div class="field-input">
<p:commandButton action="#{pedidoMobileBean.salvar()}" ajax="true" id="pcbSave" value="Salvar" update="hpgPedidoV3 :Form:hpgPedidoV1" ></p:commandButton>
</div>...
【问题讨论】:
-
听起来很奇怪,您能否给我们一些提示,可能更多关于您的表单和您的 bean 中的几行代码?我看不出你的代码有什么问题。
-
奥拉!我想这里的问题是你正在更新表单,因为当你调用保存按钮时第一个按钮有 ajax="false" 它将重新加载整个表单并再次调用该方法。
标签: jsf-2 primefaces commandbutton primefaces-mobile