我在从对话框向控制器提交数据时遇到问题。情况是我在主窗体(模板中的窗体)内有一个对话框。首先,我无法用我要编辑的数据填充对话框输入文本。解决方案是在对话框中放置一个表单,并添加属性AppendToBody。但是我无法将此数据提交给控制器。对话框中的按钮不执行任何操作。陌生人认为,当我禁用对话框并且在这种情况下可以使用按钮时,我可以在对话框中填写输入文本而无需使用任何形式。 我对JSF和Primefaces不熟悉。因此,我无法弄清问题的根源。 我使用primefaces 3.4和jsf 2.1.6-SNAPSHOT 这是代码的一部分:
<ui:define name="content">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:sec="http://www.springframework.org/security/facelets/tags"
template="/templates/template.xhtml">
<p:panel id="mainPanel" header="Parametrage des processus - workflow" rendered="#{parametrageOperationWorkflowController.showList}">
<!-- code -->
<p:dataTable var="item" sortBy="item.otherBpm" style="width:50% !important; min-width:600px;"
value="#{parametrageOperationWorkflowController.objectToDisplay.subProcessList}" paginator="true" paginatorPosition="bottom" paginatorAlwaysVisible="false" rows="10"
id="dataTableSP" selection="#{parametrageOperationWorkflowController.subProcessToEditOrDelete}" rowKey="#{item.processCode}" widgetVar="operationSubprcTable"
rendered="#{parametrageOperationWorkflowController.objectToDisplay.subProcessList != null}">
<f:facet name="header">
<p:toolbar rendered="#{parametrageOperationWorkflowController.editObjectCriterea}">
<p:toolbarGroup align="left">
<p:commandButton value="#{msg.nouveau}" type="button" icon="ui-icon-document" onclick="dlg1.show();dlg2.hide();dlg3.hide();" global="false">
</p:commandButton>
<p:separator />
<p:commandButton value="#{msg.modifier}" icon="ui-icon-disk" update=":mainForm:updateOperationSubprc" oncomplete="dlg2.show();dlg1.hide();dlg3.hide();" />
<p:separator />
<p:commandButton value="#{msg.supprimer}" icon="ui-icon-trash" update=":mainForm:deleteOperationSubprc" oncomplete="dlg3.show();dlg1.hide();dlg2.hide();" />
</p:toolbarGroup>
</p:toolbar>
</f:facet>
<p:column rendered="#{parametrageOperationWorkflowController.editObjectCriterea}" selectionMode="single" style="width:16px;text-align:center"/>
<p:column headerText="Process code:">
<h:outputText value="#{item.processCode}" />
</p:column>
<p:column headerText="Process Id:">
<h:outputText value="#{item.processId}" />
</p:column>
<p:column headerText="Moteur Workflow:">
<h:outputText value="JBPM" rendered="#{item.otherBpm == 0}" />
<h:outputText value="BPM Tools" rendered="#{item.otherBpm == 1}" />
<h:outputText value="selon région" rendered="#{item.otherBpm == 2}" />
</p:column>
</p:dataTable>
<!-- code -->
<p:dialog id="addOperationSubprc" resizable="false" header="Ajouter un nouveau sous processus" showEffect="fade" hideEffect="fade" widgetVar="dlg1" position="center">
<h:panelGrid columns="2">
<p:outputLabel for="newOperationSubprcCode" value="Code de sous process: " styleClass="simpleLabel"/>
<p:inputText id="newOperationSubprcCode" value="#{parametrageOperationWorkflowController.newSubProcess.processCode}"/>
<p:outputLabel for="newOperationSubprcId" value="Id de sous process: " styleClass="simpleLabel"/>
<p:inputText id="newOperationSubprcId" value="#{parametrageOperationWorkflowController.newSubProcess.processId}"/>
<p:outputLabel value="Moteur workflow: " for="newOperationSubprcOtherBpm" styleClass="simpleLabel"/>
<p:selectOneMenu
id="newOperationSubprcOtherBpm" value="#{parametrageOperationWorkflowController.newSubProcess.otherBpm}"
style="border-radius: 5px 5px 5px 5px;">
<f:selectItem itemLabel="JBPMN" itemValue="0" />
<f:selectItem itemLabel="BPM Tools" itemValue="1" />
</p:selectOneMenu>
<h:panelGroup><br/><br/></h:panelGroup>
<p:commandButton
value="#{msg.ajouter}" update="@form" icon="ui-icon-plus" action="#{parametrageOperationWorkflowController.createOperationSubprc()}" style="border-radius: 5px 5px 5px 5px;"
ajax="false" global="false">
</p:commandButton>
</h:panelGrid>
</p:dialog>
<p:dialog id="updateOperationSubprc" header="Modifier un sous processus" widgetVar="dlg2" position="center"
rendered="#{parametrageOperationWorkflowController.subProcessToEditOrDelete != null}">
<h:form id="updateDialogForm">
<h:panelGrid columns="2">
<p:outputLabel for="updateOperationSubprcCode" value="Code de sous processus" styleClass="simpleLabel"/>
<p:inputText cols="50" rows="1" id="updateOperationSubprcCode" value="#{parametrageOperationWorkflowController.subProcessToEditOrDelete.processCode}" />
<p:outputLabel for="updateOperationSubprcId" value="Id de sous process: " styleClass="simpleLabel"/>
<p:inputText id="updateOperationSubprcId" value="#{parametrageOperationWorkflowController.subProcessToEditOrDelete.processId}"/>
<p:outputLabel value="Moteur workflow: " for="updateOperationSubprcOtherBpm" styleClass="simpleLabel"/>
<p:selectOneMenu
id="updateOperationSubprcOtherBpm" value="#{parametrageOperationWorkflowController.subProcessToEditOrDelete.otherBpm}"
style="border-radius: 5px 5px 5px 5px;">
<f:selectItem itemLabel="JBPMN" itemValue="0" />
<f:selectItem itemLabel="BPM Tools" itemValue="1" />
</p:selectOneMenu>
<h:panelGroup><br/><br/></h:panelGroup>
<p:commandButton
value="#{msg.modifier}" icon="ui-icon-pencil" action="#{parametrageOperationWorkflowController.updateOperationSubprc()}" style="border-radius: 5px 5px 5px 5px;"
ajax="false" global="false">
</p:commandButton>
</h:panelGrid>
</h:form>
</p:dialog>
<p:dialog id="deleteOperationSubprc" resizable="false" header="Suprimer un sous processus" showEffect="fade" hideEffect="fade" widgetVar="dlg3" position="center"
rendered="#{parametrageOperationWorkflowController.subProcessToEditOrDelete != null}">
<p:outputLabel for="deleteOperationSubprcCode" value="Voulez vous supprimer le sous processus suivant? " styleClass="simpleLabel"/>
<h:panelGrid columns="2" rendered="#{parametrageOperationWorkflowController.subProcessToEditOrDelete != null}">
<p:outputLabel for="deleteOperationSubprcCode" value="Code de sous process: " styleClass="simpleLabel"/>
<p:inputText id="deleteOperationSubprcCode" value="#{parametrageOperationWorkflowController.subProcessToEditOrDelete.processCode}" disabled="true"/>
<p:outputLabel for="deleteOperationSubprcId" value="Id de sous process: " styleClass="simpleLabel"/>
<p:inputText id="deleteOperationSubprcId" value="#{parametrageOperationWorkflowController.subProcessToEditOrDelete.processId}" disabled="true"/>
<p:outputLabel value="Moteur workflow: " for="deleteOperationSubprcOtherBpm" styleClass="simpleLabel"/>
<p:selectOneMenu
id="deleteOperationSubprcOtherBpm" value="#{parametrageOperationWorkflowController.subProcessToEditOrDelete.otherBpm}"
style="border-radius: 5px 5px 5px 5px;" disabled="true">
<f:selectItem itemLabel="JBPMN" itemValue="0" />
<f:selectItem itemLabel="BPM Tools" itemValue="1" />
</p:selectOneMenu>
<h:panelGroup><br/><br/></h:panelGroup>
<p:commandButton
value="#{msg.supprimer}" update="@form" icon="ui-icon-trash" action="#{parametrageOperationWorkflowController.deleteOperationSubprc()}" style="border-radius: 5px 5px 5px 5px;"
ajax="false" global="false">
</p:commandButton>
</h:panelGrid>
</p:dialog>
</p:panel>
</ui:define>