Events 提交commandButton时,“primefaces”对话框消失
我对dialog有一个问题,这是我的add.xhtml: 当我点击“特使demande”时,我会在对话框中显示一条确认信息“demande d’铭文Demanteée”,但点击“特使demande”按钮后对话框消失 这里是add.xhtm:Events 提交commandButton时,“primefaces”对话框消失,events,primefaces,dialog,Events,Primefaces,Dialog,我对dialog有一个问题,这是我的add.xhtml: 当我点击“特使demande”时,我会在对话框中显示一条确认信息“demande d’铭文Demanteée”,但点击“特使demande”按钮后对话框消失 这里是add.xhtm: <h:form> <h:commandLink value="Créer un compte" onclick="dlg3.show();return false;"/> </h:form> <p:
<h:form>
<h:commandLink value="Créer un compte" onclick="dlg3.show();return false;"/>
</h:form>
<p:dialog id="modalDialoog" widgetVar="dlg3" draggable="false" resizable="false"
dynamic="true" header="Inscription">
<center>
<p:panel id="xyzBody">
<h:form id="inscri-f">
<h:panelGrid id="loginPan" columns="2" bgcolor="White">
<h:outputText value="Nom d'utilisateur :" />
<p:inputText id="username" value="#{demandeBean.login}"></p:inputText>
<h:outputText value="Mot de passe :" />
<p:password id="pwd" value="#{demandeBean.pwd}"/>
<h:commandButton value="Envoyer demande" update=":inscri-f:cr"
actionListener="#{demandeBean.envoi_dde}"></h:commandButton>
<h:commandButton value="Retour" action="page1?faces-redirect=true"></h:commandButton>
<p:outputPanel id="cr">
<h:outputText rendered="#{demandeBean.saved}" value="#{demandeBean.message}"/>
</p:outputPanel>
</h:panelGrid>
</h:form>
</p:panel>
</center>
</p:dialog>
我希望对话框在单击“特使需求”按钮后不会消失。1)将h:commandButton更改为p:commandButton
2) 将p:commandButton的ajax属性设置为true
这必须完美地工作
是的,它确实工作,h
是xmlns:h=”http://java.sun.com/jsf/html“
?是的,h是xmlns:h=”“您能解释一下为什么要这样做吗更新=“:inscri-f:cr
?为什么要更新对话框组件中的表单?
@ViewScoped
public class DemandeBean implements Serializable{
private static final long serialVersionUID = 1L;
DdeDAO ndao = new DdeDaoImpl();
private String login;
private String pwd;
private String message = "";
private boolean saved = false;
//getters and setters of all attributes
public void envoi_dde(){
Demande d = new Demande();
d.setNom_ut(this.login);
d.setPwd(this.pwd);
ndao.nouvelle_dde(d);
saved = true;
this.setMessage("Demande d'inscription envoyée");
}