我有一个打开对话框的按钮:
<p:commandButton id="addbutton" value="Новая контрольная точка" oncomplete="dlg_add.show();" rendered="#{controlPointBean.selectedSubject != null}"/>
还有一个带有向导的对话框:
<p:dialog widgetVar="dlg_add">
<p:wizard id="wizard" widgetVar="wizard">
<p:tab title="Тип контрольной точки">
<p:dataTable id="cptypes" var="cptype" value="#{controlPointBean.cptypesList}" rows="10" rowKey="#{cptype.ID}"
selection="#{controlPointBean.selectedCPType}" selectionMode="single" filteredValue="#{controlPointBean.filteredCPtypesList}">
<p:column headerText="Тип контрольной точки" filterBy="type" filterMatchMode="contains">
#{cptype.type}
</p:column>
</p:dataTable>
</p:tab>
<p:tab title="Общее">
<h:panelGrid id="data" columns="2">
<h:outputText value="Название: " />
<p:inputText value="#{controlPointBean.name}"/>
<h:outputText value="Модуль: " />
<p:inputText value="#{controlPointBean.module}"/>
<h:outputText value="Минимальный балл: " />
<p:inputText value="#{controlPointBean.minGrade}"/>
<h:outputText value="Максимальный балл: " />
<p:inputText value="#{controlPointBean.maxGrade}"/>
</h:panelGrid>
</p:tab>
<p:tab title="Завершить">
<p:panel header="Проверьте введённые данные">
<h:panelGrid id="confirmation" columns="2">
<h:outputText value="Предмет:"/>
<h:outputText styleClass="outputLabel" value="#{controlPointBean.selectedSubject.name}"/>
<h:outputText value="Тип:"/>
<h:outputText styleClass="outputLabel" value="#{controlPointBean.selectedCPType.type}"/>
<h:outputText value="Название: " />
<h:outputText styleClass="outputLabel" value="#{controlPointBean.name}"/>
<h:outputText value="Модуль: " />
<h:outputText styleClass="outputLabel" value="#{controlPointBean.module}"/>
<h:outputText value="Минимальный балл: " />
<h:outputText styleClass="outputLabel" value="#{controlPointBean.minGrade}"/>
<h:outputText value="Максимальный балл: " />
<h:outputText styleClass="outputLabel" value="#{controlPointBean.maxGrade}"/>
</h:panelGrid>
</p:panel>
<p:commandButton value="Принять" update=":form:messages, :form:DataTable" actionListener="#{controlPointBean.save}" oncomplete="dlg_add.hide();wizard.reset();"/>
</p:tab>
</p:wizard>
向导完成后,我单击“Принять”按钮,对话框关闭,更新所有内容,但对话框背景上的按钮在重新加载页面之前不会执行任何操作。在 primefaces 调试控制台中,看起来它们没有被点击。这是来自支持 bean 的方法 save():
public void save() throws SystemException{
try{
FacesContext facesContext = FacesContext.getCurrentInstance();
PortletRequest portletRequest = (PortletRequest) facesContext.getExternalContext().getRequest();
ControlPointLocalServiceUtil.addControlPoint(name, selectedSubject.getID(), selectedCPType.getID(),
module, minGrade, maxGrade, 0, PortalUtil.getUserId(portletRequest));
}
catch(RowAlreadyExistsException e){
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,
"Ошибка", e.getLocalizedMessage()));
}
finally{
selectedCPType=null;name=null;module=0;minGrade=0;maxGrade=0;
cpList= ControlPointLocalServiceUtil.findAll();
filterCPBySelectedSubject();
}
}