Bonjour,

J'ai une erreur qui apparait lors de l’exécution du code :
Target Unreachable, identifier 'clientBean' resolved to null
Voici les codes ainsi que le fichier web.xml et le fichier xhtml.
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
package com.xx.gestion.persistence;
 
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
 
@Entity
public class Client {
    private int id;
    private String nom;
    private String adresse;
    private String tele1;
    private String tele2;
private String email;
private int responsable1;
private int responsable2;
private Projet prj;
 
    public Client() {
        // TODO Auto-generated constructor stub
    }
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
    public int getId() {
        return id;
    }
 
    public void setId(int id) {
        this.id = id;
    }
 
    public String getAdresse() {
        return adresse;
    }
 
    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }
 
    public String getTele2() {
        return tele2;
    }
 
    public void setTele2(String tele2) {
        this.tele2 = tele2;
    }
 
    public String getTele1() {
        return tele1;
    }
 
    public void setTele1(String tele1) {
        this.tele1 = tele1;
    }
 
    public String getEmail() {
        return email;
    }
 
    public void setEmail(String email) {
        this.email = email;
    }
 
    public int getResponsable1() {
        return responsable1;
    }
 
    public void setResponsable1(int responsable1) {
        this.responsable1 = responsable1;
    }
 
    public int getResponsable2() {
        return responsable2;
    }
 
    public void setResponsable2(int responsable2) {
        this.responsable2 = responsable2;
    }
    @OneToOne
    public Projet getPrj() {
        return prj;
    }
    public void setPrj(Projet prj) {
        this.prj = prj;
    }
    public String getNom() {
        return nom;
    }
    public void setNom(String nom) {
        this.nom = nom;
    }
}
le bean correspondant est:
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
package com.xx.gestion.controlleur;
 
import javax.annotation.ManagedBean;
import javax.faces.bean.SessionScoped;
 
import com.xx.gestion.dao.Clientdao;
import com.xx.gestion.persistence.Client;
 
@ManagedBean
@SessionScoped
public class clientBean {
    private Client cl=new Client();
    Clientdao cldao=new Clientdao();
    /******************************************************/
    public Client getCl() {
        return cl;
    }
    public void setCl(Client cl) {
        this.cl = cl;
    }
 
    /*******************************************/
    public String ajouter() {
        cldao.ajouter(cl);
        return null;
    }
    public clientBean() {
        // TODO Auto-generated constructor stub
    }
}
le fichier web.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>Jsf2Primefaces</display-name>
 
    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>bluesky</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
    <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>resources.application</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
 
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
 
    <welcome-file-list>
        <welcome-file> home.xhtml</welcome-file>
    </welcome-file-list>
</web-app>
et le fichier client.xhtml est:
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
 
<?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:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title> Création d'un client</title>
    </h:head>
    <h:body>
 
        <p:panel header="Informations client">
            <h:form>
                <h:panelGrid columns="3" cellpadding="2" >
                        <h:outputLabel for="nom" value="Nom" />
                        <h:inputText id="nom" value="#{clientBean.cl.nom}" label="Nom" required="true" />     
                        <h:message for="nom" />
 
                        <p:commandButton action="#{clientBean.ajouter}" value="Ajouter" />
 
                        <input type="reset" value="Remettre à zéro" />
               </h:panelGrid>
           </h:form>
       </p:panel>
   </h:body>
</html>
Quelqu'un saurait-il m'indiquer d'où peut venir le problème ?

Merci d'avance pour votre aide.