从昨天开始我就被困在这里我有一个页面 jsf 进入 p:dialog 这是页面 A 中的对话框
<p:commandButton value="Ajouter" rendered="#{LigneXL.resultat eq 'N existe pas'}" oncomplete="Ajouter.show()" action="#{composantbean.initialise()}" >
</p:commandButton>
<p:dialog id="Ajout" dynamic="true" appendToBody="true" modal="true"
widgetVar="Ajouter" closable="true" height="800" width="800" >
<ui:include src="/pagess/pagesComposant/AjoutCFromXls.xhtml" />
</p:dialog>
这是显示页面进入对话框的核心
<ui:component xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
<h:form id="form">
<h:panelGrid columns="1" cellpadding="5" width="100%">
<p:panel header ="caracteristique composant" id="panel1" >
<p:messages id="messages2" />
<h:panelGrid columns="4" cellpadding="5" width="100%">
<h:outputLabel value="Ref_composant:" for="nom" />
<p:inputText id="nom" value="#{composantbean.selcetitem.refComposant}" required="true">
<p:ajax event="keyup" listener="#{composantbean.filterListener}" />
</p:inputText>
<h:outputLabel value="Fabricant:" />
<p:selectOneMenu value="#{composantbean.selectedFabricantId}" required="true">
<f:selectItem itemLabel="Select Fabricant" itemValue="" />
<f:selectItems value="#{composantbean.listfab}" var="fabri" itemValue="#{fabri.idFabricant}" itemLabel="#{fabri.nomFabricant}" />
<p:ajax event="change" listener="#{composantbean.fabListener()}"/>
</p:selectOneMenu>
<h:outputLabel value="type_article :" />
<p:selectOneMenu value="#{composantbean.selcetitem.typeArticle}" required="true">
<f:selectItem itemLabel="Select Type" itemValue="" />
<f:selectItem itemLabel="Composant" itemValue="Composant" />
<f:selectItem itemLabel="Serie" itemValue="Serie" />
</p:selectOneMenu>
<h:outputLabel value="Categorie :" />
<p:selectOneMenu value="#{composantbean.selectedCategoryId}" required="true" >
<f:selectItem itemLabel="Select categorie" itemValue="" />
<f:selectItems value="#{composantbean.listcat}" var="cat" itemValue="#{cat.nomCat}" itemLabel="#{cat.nomCat}" />
<p:ajax update="panlecart2" event="change" listener="#{composantbean.catListener()}"/>
</p:selectOneMenu>
<h:outputLabel value="Type_famille :" />
<p:selectOneMenu value="#{composantbean.selcetitem.typeFamille}" required="true">
<f:selectItem itemLabel="Select TypeFamille" itemValue="" />
<f:selectItem itemLabel="Actif" itemValue="Actif" />
<f:selectItem itemLabel="Passifs" itemValue="Passifs" />
<f:selectItem itemLabel="Particuliers" itemValue="Particuliers" />
</p:selectOneMenu>
<h:outputLabel value="Statut:" />
<p:selectOneMenu value="#{composantbean.selcetitem.statut}" required="true">
<f:selectItem itemLabel="Select Statut" itemValue="" />
<f:selectItem itemLabel="Actif" itemValue="Actif" />
<f:selectItem itemLabel="Obsolete" itemValue="Obsolete" />
<f:selectItem itemLabel="En voi d obsolescence" itemValue="En voi d obsolescence" />
<f:selectItem itemLabel="Obsolete mais diponible" itemValue="Obsolete mais diponible" />
</p:selectOneMenu>
<h:outputLabel value="Serie" />
<p:selectOneMenu value="#{composantbean.selcetitem.serie}" >
<f:selectItem itemLabel="Select Serie" itemValue="" />
<f:selectItems value="#{composantbean.listSeries}" />
</p:selectOneMenu>
<h:outputLabel value="RoHS :" />
<p:selectOneMenu value="#{composantbean.selcetitem.rohs}" required="true">
<f:selectItem itemLabel="Select RoHS" itemValue="" />
<f:selectItem itemLabel="NA" itemValue="NA" />
<f:selectItem itemLabel="OUI" itemValue="OUI" />
<f:selectItem itemLabel="NON" itemValue="NON" />
<f:selectItem itemLabel="Sans Statut" itemValue="Sans Statut" />
</p:selectOneMenu>
<h:outputLabel value="SVHC_Presence" />
<p:selectOneMenu value="#{composantbean.selcetitem.svhcPresence}" required="true">
<f:selectItem itemLabel="Select svhcPresence" itemValue="" />
<f:selectItem itemLabel="NA" itemValue="NA" />
<f:selectItem itemLabel="OUI" itemValue="OUI" />
<f:selectItem itemLabel="NON" itemValue="NON" />
<f:selectItem itemLabel="Sans Statut" itemValue="Sans Statut" />
</p:selectOneMenu>
<h:outputLabel value="SVHC_Source" />
<p:selectOneMenu value="#{composantbean.selcetitem.svhcSource}" >
<f:selectItem itemLabel="Select svhcSource" itemValue="" />
<f:selectItem itemLabel="Template" itemValue="Template" />
<f:selectItem itemLabel="FMD" itemValue="FMD" />
<f:selectItem itemLabel="COFC" itemValue="COFC" />
</p:selectOneMenu>
<h:outputLabel value="Pdsl_Presence" />
<p:selectOneMenu value="#{composantbean.selcetitem.pdslPresence}" required="true">
<f:selectItem itemLabel="Select pdslPresence" itemValue="" />
<f:selectItem itemLabel="NA" itemValue="NA" />
<f:selectItem itemLabel="OUI" itemValue="OUI" />
<f:selectItem itemLabel="NON" itemValue="NON" />
<f:selectItem itemLabel="Sans Statut" itemValue="Sans Statut" />
</p:selectOneMenu>
<h:outputLabel value="Suivi :" />
<p:selectOneMenu value="#{composantbean.selcetitem.suivi}" required="true">
<f:selectItem itemLabel="Select suivi" itemValue="" />
<f:selectItem itemLabel="OUI" itemValue="OUI" />
<f:selectItem itemLabel="NON" itemValue="NON" />
</p:selectOneMenu>
</h:panelGrid>
</p:panel>
<p:commandButton id="showDialogButton" value="Ajouter" onclick="confirmation.show()" update="panel1" />
<p:commandButton value="Annuler" process="@this" onclick="Ajouter.hide()">
</p:commandButton>
<p:confirmDialog id="confirmDialog" appendToBody="true"
message="Confirmation d'Ajout " header="Ajouter Composant" severity="alert" widgetVar="confirmation">
<p:commandButton id="confirm" value="Oui Sure" oncomplete="confirmation.hide()" process="@this"
action="#{composantbean.inserer2()}" >
<p:resetInput target="panel1" />
</p:commandButton>
<p:commandButton id="decline" value="Non encore" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>
</h:form>
</ui:component>
用于添加组件的对话框 sohw me 表单。它工作正常
但问题是。当我再次调用对话框时,它会保留插入元素的先前值
母猪我做这个方法豆composantbean
public void initialise(){
selcetitem=new Composant();
selcetitem.setRohs("NA");
selcetitem.setSvhcPresence("NA");
selcetitem.setSvhcSource("");
selcetitem.setPdslPresence("NA");
selcetitem.setSuivi("OUI");
selcetitem.setTypeArticle("");
selcetitem.setTypeFamille("");
selcetitem.setStatut("");
selectedFabricantId=0;
selectedCategoryId="Selec";
}
此 mlethode 已执行,但从不同步对话框!
嗬嗬我做!!!提前谢谢你
注意:当页面退出对话框时,问题就解决了。我认为 p:dialog 没有用我的 bean 刷新