问题是我正在尝试按下按钮 - >转到支持bean - >将布尔值设置为false / true并相应地显示弹出窗口。如果弹出窗口显示 - >调用方法并执行它。
上面的工作正常,但是当我点击弹出式面板中的按钮时,我点击第一个按钮后输入的字段似乎丢失了。所以我在第一次点击后得到的所有参数(它们都进入了支持bean对象)都没有第二次点击(在弹出窗口中)。这可能是什么?
它只是一种形式,所有按钮和输入字段等都在一个a4j:region ..幕后没有验证错误。
我有以下支持豆(请注意,我故意没有把整个bb放在那里注射等...):
@ManagedBean(name = "dossierInTreatmentBB")
@ViewScoped
public class DossierInTreatmentBackingBean {
/** The show center popup. */
private boolean showCenterPopup;
/** The continue assign without report. */
private boolean continueAssignWithoutReport;
public void assign() throws IOException {
if (!continueAssignWithoutReport) {
ExternalOffice eo = annucompLocal.findOfficeByCrestraCode(getEntity().getServiceTreatment());
showCenterPopup = OfficeLevel.CENTER.equals(eo.getServiceType().getOfficeLevel())
}
if (!showCenterPopup) {
dossierInTreatmentDossierLocal.assign();
//refreshes the entity
setDTO(null);
if (!DossierContext.isEditAllowed(getDossier())) {
String url = getRequestContextPath() + "/dossier/consult/detail.jsf?id=%s";
redirect(url, getDossier().getId().toString());
}
}
}
/**
* Assign without report.
* @throws IOException Signals that an I/O exception has occurred.
*/
public void assignWithoutReport() throws IOException {
showCenterPopup = false;
continueAssignWithoutReport = true;
assign();
}
... needed getters and setters ...
这是我的观点(assign.xhtml):
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ccffdecorate="http://java.sun.com/jsf/composite/ccffdecorate"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j">
<a4j:region>
<h:panelGrid layout="block" styleClass="rSplitPanel2" columns="2"
rendered="#{not empty entityBB.entity}">
"some input fields"
</h:panelGrid>
<h:panelGroup layout="block" styleClass="rButtonPanel">
<h:commandButton value="#{AppMessages['general.action.save']}">
<a4j:ajax
render="dossierInTreatmentPanel :messages centerPopupGroup"
listener="#{entityBB.assign}" status="ajaxStatus"
oncomplete="#{rich:component('centerPopup')}.show()" />
</h:commandButton>
<h:commandButton value="#{AppMessages['general.action.cancel']}">
<a4j:ajax execute="@this" render="dossierInTreatmentPanel :messages"
listener="#{entityBB.cancel}" status="ajaxStatus" />
</h:commandButton>
</h:panelGroup>
<h:panelGroup id="centerPopupGroup">
<rich:popupPanel id="centerPopup" modal="true" autosized="true"
rendered="#{entityBB.showCenterPopup}"
onmaskclick="#{rich:component('centerPopupPanel')}.hide()">
<div class="rButtonPanel">
<h:commandButton value="#{AppMessages['general.action.next']}">
<a4j:ajax listener="#{entityBB.assignWithoutReport()}"
status="ajaxStatus"
oncomplete="#{rich:component('centerPopup')}.hide();" />
</h:commandButton>
<h:commandButton value="#{AppMessages['general.action.cancel']}">
<a4j:ajax listener="#{entityBB.cancel}" limitRender="true"
status="ajaxStatus"
onclick="#{rich:component('centerPopup')}.hide(); return false;" />
</h:commandButton>
</div>
</rich:popupPanel>
</h:panelGroup>
</a4j:region>
dit.xhtml:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:e="http://minfin.regondes2/entity"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:l="http://minfin.regondes2/layout">
<ui:include src="assignBlock/assign.xhtml" />
dossier.xhtml:
<h:form>
<ui:include src="dit.xhtml" />
</h:form>
我很抱歉没有让视图更紧凑,但是因为我猜测问题位于视图中我正在显示整个结构。
答案 0 :(得分:0)
终于找到了它。
必须添加2个不同的a4j:区域。表单为1,弹出面板为1 ..