Assuming that the bean is in the view scope, just set it as a bean property direclty in the action method of the command button in the datatable column.
<h:form>
<p:dataTable var="form" value="#{myBean.formList}">
<p:column>
<p:commandButton id="selectProduct"
action="#{myBean.setCurrentForm(form)}"
update="selectProductForm" oncomplete="selectProductDlg.show()"
image="ui-icon-">
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
<p:dialog>
<h:form>
<p:commandButton action="#{myBean.setSelected}"
update="main_form"
oncomplete="if(#{myBean.errorText == 'SUCCESS'}){ selectProductDlg.hide();}"
value="Sec">
</p:commandButton>
</h:form>
</p:dialog>
If you have a cancel button in the dialog, you need to let its action method set it to null
.
There's no need to fiddle around with raw HTTP request parameters in POST requests. The <f:param>
should as much as possible be used in GET requests only (e.g. <h:link>
, <h:button>
, etc).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…