下面是My DataTable
<p:dataTable id="datalist" value="#{purchaseOrderDetailFileController.heldOrderList}" var="item"
selectionMode="single" selection="#{purchaseOrderDetailFileController.selected}"
paginator="true"
rowKey="#{item.id}" tableStyle="width:auto"
rows="10"
rowsPerPageTemplate="10,20,30,40,50"
>
<p:column style="width:6rem">
<p:commandButton value="Release" action="#{procurementModule.releaseHoldOrder(item)}" update="datalist, :growl" icon="pi pi-check" styleClass="rounded-button p-mr-2 p-mb-2">
<p:confirm type="popup" header="Release Password" message="Please Provide Release Password" icon="pi pi-exclamation-triangle"/>
</p:commandButton>
</p:column>
<p:column >
<f:facet name="header">
<h:outputText value="Hold Code"/>
</f:facet>
<h:outputText value="#{item.purchaseOrderHeader.holdOrdersCode}"/>
</p:column>
</p:datatable>
下面是我的p:confirmPopup
<p:confirmPopup global="true">
<p:inputText id="password2" immediate="true" value="#{purchaseOrderDetailFileController.orderReleasePassword}">
</p:inputText><p:spacer/><p:spacer/><p:spacer/><p:spacer/><p:spacer/><p:spacer/>
<p:commandButton value="Submit" type="button" styleClass="ui-confirm-popup-yes" >
</p:commandButton>
</p:confirmPopup>
我的方法在我的bean
public void releaseHoldOrder(PurchaseOrderDetailFile item) {
try {
FacesContext context = FacesContext.getCurrentInstance();
ELContext elContext = context.getELContext();
HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
PurchaseOrderDetailFileController purchaseOrderDetailFileController = (PurchaseOrderDetailFileController) elContext.getELResolver().getValue(elContext, null, "purchaseOrderDetailFileController");
String password = purchaseOrderDetailFileController.getOrderReleasePassword();
} catch(Exception e){
e.prinStackTrace();
}
问题是我没有从我的bean中的输入文本中获得值。我错过了什么?是否有任何可能的方法从primefaces confirmPopup传递参数到我的java bean。
您需要使用对话框才能使其正常工作。
<p:dialog id="confirm" header="Confirmation">
<h:form>
<p:inputText id="value" value="#{someBean.someProperty}" />
<!-- other form components -->
<f:facet name="footer">
<p:commandButton type="button" value="No" styleClass="ui-button-flat p-mr-2" style="width: 6rem" />
<p:commandButton type="button" value="Yes" style="width: 5rem" />
</f:facet>
</h:form>
</p:dialog>