Bonjour tout le monde,
je suis débutante en jsf et j'essaie de faire un formulaire à l'aide de jsf et primefaces mais j'ai un problème car le bouton action ne déclenche pas l'action souhaitée ,voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
       xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>inscription</title>
 
    </h:head>
    <h:body>
        <p:layout style="min-width:400px;min-height:200px;" id="layout">  
    <p:layoutUnit position="west" resizable="true" size="100" minSize="40" maxSize="200">  
        Left  
    </p:layoutUnit> 
        <h:form id="form">  
 
    <p:growl id="growl" showDetail="true"/>  
  <p:layoutUnit position="center">
    <img src="images/logo.jpg" alt="logo"/>
    <h3>-espace Candidat-</h3>
    <p:panel header="Inscription Candidat" footer="recommandations inscription">  
       <h:outputText value="les champs mentionnées par * doivent etre remplis pour accomplir votre
                     inscription. Merci !!" />  
 
       <center>
        <p:panelGrid columns="2">  
    <f:facet name="header">  
     Inscrivez vous 
    </f:facet>  
 
    <p:outputLabel for="nom" value="Nom: *" />  
    <p:inputText id="nom" value="#{imaneBean.nomCandidat}" label="Nom" /> 
 
 
 
 
    <f:facet name="footer">  
        <p:commandButton  id="saveButton" type="button" value="save" icon="ui-icon-disk" style="margin:0" action="#{imaneBean.insert()}"/>
        <p:commandButton type="button" value="exit" icon="ui-icon-circle-close" style="margin:0"/>
 
    </f:facet>  
</p:panelGrid>  
       </center>
    </p:panel>
    </p:layoutUnit>  
 
 
        </h:form>
 
</p:layout>  
 
    </h:body>
</html>
et le bean :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Bean;
import DAO.connexionBD;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Date;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
 
/**
 *
 * @author hp
 */
public class imaneBean implements Serializable{
 
    private String nomCandidat;
 
    private String prenomCandidat;
 
    private Character sexe;
 
 
 
    private Date dateNaissance;
 
    private String type;
 
    private String mail;
 
    private String adresse;
 
    public String getNomCandidat() {
        return this.nomCandidat;
    }
 
    public void setNomCandidat(String nomCandidat) {
        this.nomCandidat = nomCandidat;
    }
 
    public String getPrenomCandidat() {
        return prenomCandidat;
    }
 
    public void setPrenomCandidat(String prenomCandidat) {
        this.prenomCandidat = prenomCandidat;
    }
 
    public Character getSexe() {
        return sexe;
    }
 
    public void setSexe(Character sexe) {
        this.sexe = sexe;
    }
 
 
 
    public Date getDateNaissance() {
        return dateNaissance;
    }
 
    public void setDateNaissance(Date dateNaissance) {
        this.dateNaissance = dateNaissance;
    }
 
    public String getType() {
        return type;
    }
 
    public void setType(String type) {
        this.type = type;
    }
 
    public String getMail() {
        return mail;
    }
 
    public void setMail(String mail) {
        this.mail = mail;
    }
 
    public String getAdresse() {
        return adresse;
    }
 
    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }
 
 
    public void insert(){
 
 
        int val = 0; 
 
        try 
{ 
 
 
 
Class.forName("com.mysql.jdbc.Driver"); 
System.out.println ("driver etablie"); 
} 
catch(Exception e) 
{ 
System.out.println ("erreur:Driver int" + 
"rouvable"); 
} 
 
 
try { 
 
    String URL = "jdbc:mysql://localhost:3306/concours"; 
String USER = "root"; 
String PASSWD = "ensias"; 
 Connection con=null;
 
con =DriverManager.getConnection(URL,USER, PASSWD);
   //DAO.connexionBD c=new connexionBD();
   //c.connexion();
 
   //Connection con=null;
 
      Statement st;
st = con.createStatement();
 
val = st.executeUpdate("INSERT INTO `user` (`login`) VALUES('"+nomCandidat+"')");
//
System.out.append("insertionaccomplie");
} catch (SQLException ex) { 
Logger.getLogger(connexionBD.class.getName()).log(Level.SEVERE, null, ex); 
} 
 
System.out.println(val); 
 
    }
    /**
     * icon="ui-icon-disk" style="margin:0"
     * Creates a new instance of imaneBean
     */
    public imaneBean() {
        nomCandidat="";
    }
}
merci pour votre aide