1

ダイアログに問題があります。ここに私の add.xhtml があります。「Envoyer demande」をクリックすると、ダイアログに「Demande d'inscription envoyée」という確認メッセージが表示されますが、ボタン「Envoyer demande」をクリックするとダイアログが消えます。

ここに add.xhtm があります:

<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>

私の addBean.java :

 @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");

   }

ボタン「Envoyer demande」をクリックした後、ダイアログが消えないようにしたい。

4

1 に答える 1

2

1) h:commandButton を p:commandButton に変更します 2) p:commandButton の ajax 属性を true に設定します

これは完全に機能する必要があります

于 2013-06-09T06:48:57.707 に答える