PrimeFaces CommandButton在Dialog中不起作用

时间:2015-05-07 13:43:44

标签: primefaces dialog commandbutton

我需要您的帮助来解决对话框中CommandButton的问题,因为我在操作中调用了一个名为UpdatePrint()的方法,但未调用它。 jsf页面代码如下:

<h:form id="Requests">
.
.
.
<p:commandButton update=":Requests:#{hr.dialogueName}" oncomplete="PF('#{hr.certificateDialogue}').show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{hr}" target="#{hrd.selectedRequest}"/>
</p:commandButton>
.
.
<p:dialog header="cert1" widgetVar="cert1" modal="true" showEffect="fade" hideEffect="fade" resizable="true">
<p:outputPanel id="HRCEEN" style="text-align:center;">
</p:outputPanel>
 <p:commandButton value="Print" action="#{hrd.UpdatePrint}" type="button" icon="ui-icon-print"  style="display:block;margin-bottom: 20px">
<p:printer target="HRCEEN"/>
</p:commandButton>
</p:dialog>
.
.

<p:dialog header="cert2" widgetVar="cert2" modal="true" showEffect="fade" hideEffect="fade" resizable="true">
<p:outputPanel id="HRSSEN" style="text-align:center;">
</p:outputPanel>
<p:commandButton value="Print" action="#{hrd.UpdatePrint}" type="button" icon="ui-icon-print"  style="display:block;margin-bottom: 20px">
<p:printer target="HRSSEN"/>
</p:commandButton>
</p:dialog>

</h:form>

我尝试了不同的方法,但我并没有成功,因为它告诉我在更新时引用更新中的部分。

 <p:commandButton update=":Requests:#{hr.dialogueName}" oncomplete="PF('#{hr.certificateDialogue}').show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{hr}" target="#{hrd.selectedRequest}"/>
</p:commandButton>

1 个答案:

答案 0 :(得分:1)

由于type="button"属性,未调用action方法 - 没有提交给服务器。删除type,然后将触发操作(该按钮将采用默认的submit类型)。

相关问题