Bonjour,

J'ai quelques soucis pour utiliser le composant selecftOneMenu
A partir de cette combo, j'affiche des bean. J'ai une autre combo qui affiche une enum et quand la valeur change, je recharge les autres combo.
Le problème est que quand je modifie la valeur, j'obtiens le message suivant :

Erreur de conversion lors de la définition de la valeur "france" pour "null converter"
Voici ma page :
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
<ui:composition template="../../secured/modele/template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<ui:define name="contenu">
		<h:form id="ajouterIdentiteForm">
			<div align="center">
				<h2>
					<h:outputText value="#{msg['AjouterUneIdentite']}" />
				</h2>
				
				<p:growl id="messages" showDetail="true" />
				
				<p:panelGrid columns="1" style="margin-bottom:15px; border: none;" layout="grid">
					<p:panelGrid  columns="2" styleClass="panelSansBordure">
						<!-- Identité -->
						<h:outputLabel value="#{msg['Identite']} : " styleClass="formulaireTitre" />
						<h:outputLabel value="" />

						<h:outputLabel for="typePersonne" value="#{msg['Type']} : " styleClass="mandatory" />
						<p:selectOneMenu id="typePersonne" required="true" immediate="true" onchange="submit();"
									valueChangeListener="#{ajouterIdentiteForm.reinitialiserIdentite}" value="#{ajouterIdentiteForm.typePersonne}" style="width:400px">
            				<f:selectItems value="#{ajouterIdentiteForm.listTypePersonnes}" />
        				</p:selectOneMenu>		
						<h:outputLabel for="nom" id="labelNom" value="#{msg['Nom']} (50) : " styleClass="mandatory" rendered="#{ajouterIdentiteForm.typePersonne.abrege == 'P'}" />
						<p:inputText id="nom" value="#{ajouterIdentiteForm.nom}" size="50" maxlength="50" rendered="#{ajouterIdentiteForm.typePersonne.abrege eq 'P'}" />
						
						<h:outputLabel for="prenom" id="labelPrenom" value="#{msg['Prenom']} (50) : " styleClass="mandatory" rendered="#{ajouterIdentiteForm.typePersonne.abrege eq 'P'}" />
						<p:inputText id="prenom" value="#{ajouterIdentiteForm.prenom}" size="50" maxlength="50" rendered="#{ajouterIdentiteForm.typePersonne.abrege eq 'P'}" />
		
						<h:outputLabel for="raisonSociale" id="labelRaisonSociale" value="#{msg['RaisonSociale']} (100) : " styleClass="mandatory" rendered="#{ajouterIdentiteForm.typePersonne.abrege eq 'M'}" />
						<p:inputText id="raisonSociale" value="#{ajouterIdentiteForm.raisonSociale}" size="50" maxlength="50" rendered="#{ajouterIdentiteForm.typePersonne.abrege eq 'M'}" />
					
						<!-- Adresse -->
						<h:outputLabel value="#{msg['Adresse']} : " styleClass="formulaireTitre" />
						<h:outputLabel value="" />
						
						<h:outputLabel for="pays" value="#{msg['Pays']} : " />
						<p:selectOneMenu id="pays" required="false" value="#{ajouterIdentiteForm.pays}" style="width:400px">
            				                <f:selectItems value="#{ajouterIdentiteForm.listPays}" />
        				        </p:selectOneMenu>        				
        				<h:outputLabel for="canton" value="#{msg['Canton']} : " />
						<p:selectOneMenu id="canton" required="false" value="#{ajouterIdentiteForm.canton}" style="width:400px">
							<f:converter converterId="PaysConverter" />
            				<f:selectItems value="#{ajouterIdentiteForm.listCantons}" />
        				</p:selectOneMenu>
						
						<h:outputLabel for="rueNumero" value="#{msg['RueEtNumero']} : " />
						<p:inputText id="rueNumero" value="#{ajouterIdentiteForm .rueNumero}" size="50" maxlength="100" />
						
						<h:outputLabel for="casePostale" value="#{msg['CasePostale']} : " />
						<p:inputText id="casePostale" value="#{ajouterIdentiteForm.casePostale}" size="50" maxlength="100" />
		
						<h:outputLabel for="localite" value="#{msg['Localite']} : " />
						<p:selectOneMenu id="localite" required="false" value="#{ajouterIdentiteForm.localite}" style="width:400px">
            				<f:selectItems value="#{ajouterIdentiteForm.listLocalites}" />
        				</p:selectOneMenu>
		
						<h:outputLabel for="codePostalLibre" value="#{msg['CodePostal']} : " rendered="#{ajouterIdentiteForm.pays.id == 1}" />
						<p:inputText id="codePostalLibre" value="#{ajouterIdentiteForm.codePostalLibre}" size="50" maxlength="100" rendered="#{ajouterIdentiteForm.pays.id == 1}" />
		
						<h:outputLabel for="localiteLibre" value="#{msg['Localite']} : " rendered="#{ajouterIdentiteForm.pays.id != 1}" />
						<p:inputText id="localiteLibre" value="#{ajouterIdentiteForm.localiteLibre}" size="50" maxlength="100" rendered="#{ajouterIdentiteForm.pays.id != 1}" />
		
						<h:outputLabel for="noTelProf" value="#{msg['NoTelProf']} : " />
						<p:inputText id="noTelProf" value="#{ajouterIdentiteForm.noTelProf}" size="50" maxlength="50" />
						
						<h:outputLabel for="noTelMobile" value="#{msg['NoTelMobile']} : " />
						<p:inputText id="noTelMobile" value="#{ajouterIdentiteForm.noTelMobile}" size="50" maxlength="50" />
						
						<h:outputLabel for="noTelPrive" value="#{msg['NoTelPrive']} : " />
						<p:inputText id="noTelPrive" value="#{ajouterIdentiteForm.noTelPrive}" size="50" maxlength="50" />
						
						<h:outputLabel for="email" value="#{msg['Email']} : " />
						<p:inputText id="email" value="#{ajouterIdentiteForm.email}" size="50" maxlength="50" />
						
						<h:outputLabel for="noFax" value="#{msg['NoFax']} : " />
						<p:inputText id="noFax" value="#{ajouterIdentiteForm.noFax}" size="50" maxlength="50" />
					</p:panelGrid>
				</p:panelGrid>
				
				<p:commandButton value="#{msg['Ajouter']}" icon="ui-icon-check"
					style="margin:15px" action="#{ajouterIdentiteForm.ajouterIdentite}" />
				<p:commandButton value="#{msg['Annuler']}" icon="ui-icon-close"
					immediate="true" style="margin:15px"
					action="#{ajouterIdentiteForm.cancel}" />
			</div>
		</h:form>
	</ui:define>
</ui:composition>
J'ai essayé d'utiliser un converter mais eclipse met un avertissement :

PaysConverter' converter id is not registered
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
 
@FacesConverter(value = "PaysConverter")
public class PaysConverter extends BeanConverter {
 
	@EJB
	private AdresseService m_adresseService;
 
	@Override
	public Object getAsObject(FacesContext context, UIComponent component,
			String value) {
		if (value != null) {
			Pays pays = m_adresseService.getPays(1);
			return pays;
		}
 
		return null;
	}
 
}
Et le managedbean :
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
 
@ManagedBean(name = "ajouterIdentiteForm")
@RequestScoped
public class AjouterIdentiteBean {
 
	private TypePersonneCi typePersonne = TypePersonneCi.PHYSIQUE;
	private String nom;
	private String prenom;
	private String raisonSociale;
	private Pays pays;
	private Canton canton;
	private String rueNumero;
	private String casePostale;
	private Localite localite;
	private String codePostalLibre;
	private String localiteLibre;
	private String noTelProf;
	private String noTelMobile;
	private String noTelPrive;
	private String email;
	private String noFax;
 
	// Listes
	private List<TypePersonneCi> listTypePersonnes;
	private List<Pays> listPays;
	private List<Canton> listCantons;
 
	// Services
	@EJB
	private IdentiteService m_identiteService;
	@EJB
	private AdresseService m_adresseService;
 
	/**
         * Default Constructor
         */
	public AjouterIdentiteBean() {
	}
 
	public List<TypePersonneCi> getListTypePersonnes() {
		if (listTypePersonnes == null) {
			listTypePersonnes = new ArrayList<>();
			listTypePersonnes.add(TypePersonneCi.PHYSIQUE);
			listTypePersonnes.add(TypePersonneCi.MORALE);
		}
 
		return listTypePersonnes;
	}
 
	public List<Pays> getListPays() {
		if (listPays == null) {
			listPays = m_adresseService.getPaysList();
		}
 
		return listPays;
	}
 
	public List<Canton> getListCantons() {
		if (listCantons == null) {
			listCantons = m_adresseService.getCantonList();
		}
 
		return listCantons;
	}
 
	public List<Localite> getListLocalites() {
		return m_adresseService.getLocaliteListByCanton(m_adresseService.getCanton(1));
	}
 
	public void reinitialiserIdentite() {
		if (TypePersonneCi.PHYSIQUE == typePersonne) {
			raisonSociale = null;
		} else {
			nom = null;
			prenom = null;
		}
	}
 
	/**
         * Ajouter l'identité dans la base de données
         */
	public String ajouterIdentite() {
		try {
			Identite identite = new Identite();
			identite.setTypePersonneCi(typePersonne);
			identite.setNom(nom);
			identite.setPrenom(prenom);
			identite.setRaisonSociale(raisonSociale);
 
			Adresse adresse2 = new Adresse();
			adresse2.setTypeAdresse(TypeAdresseCi.SECONDAIRE);
			adresse2.setRueNumero("johns 46+");
			adresse2.setNoTelProf("bobby");
			adresse2.setNoTelMobile("bobby");
			adresse2.setNoTelPrive("bobby");
			adresse2.setEmail("bobby");
			adresse2.setNoFax("bobby");
 
			identite.addAdresse(adresse2);
 
			Adresse adresse = new Adresse();
			adresse.setTypeAdresse(TypeAdresseCi.PRINCIPALE);
			adresse.setRueNumero(rueNumero);
			adresse.setLocalite(localite);
			adresse.setNoTelProf(noTelProf);
			adresse.setNoTelMobile(noTelMobile);
			adresse.setNoTelPrive(noTelPrive);
			adresse.setEmail(email);
			adresse.setNoFax(noFax);
 
			identite.addAdresse(adresse);
 
			Adresse adresse1 = new Adresse();
			adresse1.setTypeAdresse(TypeAdresseCi.SECONDAIRE);
			adresse1.setRueNumero("bobby 4521");
			adresse1.setNoTelProf("csac");
			adresse1.setNoTelMobile("csac");
			adresse1.setNoTelPrive("csac");
			adresse1.setEmail("csac");
			adresse1.setNoFax("csac");
 
			identite.addAdresse(adresse1);
 
			m_identiteService.createIdentite(identite);
 
			FacesContext.getCurrentInstance().addMessage(
					null,
					Messages.getMessage("LIdentiteAEteAjouteeAvecSucces",
							FacesMessage.SEVERITY_INFO, null));
		} catch (Throwable e) {
			System.out.println(e);
			FacesContext.getCurrentInstance().addMessage(null,
					new FacesMessage(e.getMessage()));
			return "failure";
		}
 
		return "identite";
	}
 
	/**
         * Redirige vers la page de gestion des identités
         */
	public String cancel() {
		return "identite";
	}
 
	public TypePersonneCi getTypePersonne() {
		return typePersonne;
	}
 
	public void setTypePersonne(TypePersonneCi typePersonne) {
		this.typePersonne = typePersonne;
	}
 
	public String getNom() {
		return nom;
	}
 
	public void setNom(String nom) {
		this.nom = nom;
	}
 
	public String getPrenom() {
		return prenom;
	}
 
	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}
 
	public String getRaisonSociale() {
		return raisonSociale;
	}
 
	public void setRaisonSociale(String raisonSociale) {
		this.raisonSociale = raisonSociale;
	}
 
	public Pays getPays() {
		return pays;
	}
 
	public void setPays(Pays pays) {
		this.pays = pays;
	}
 
	public Canton getCanton() {
		return canton;
	}
 
	public void setCanton(Canton canton) {
		this.canton = canton;
	}
 
	public String getRueNumero() {
		return rueNumero;
	}
 
	public void setRueNumero(String rueNumero) {
		this.rueNumero = rueNumero;
	}
 
	public String getCasePostale() {
		return casePostale;
	}
 
	public void setCasePostale(String casePostale) {
		this.casePostale = casePostale;
	}
 
	public Localite getLocalite() {
		return localite;
	}
 
	public void setLocalite(Localite localite) {
		this.localite = localite;
	}
 
	public String getCodePostalLibre() {
		return codePostalLibre;
	}
 
	public void setCodePostalLibre(String codePostalLibre) {
		this.codePostalLibre = codePostalLibre;
	}
 
	public String getLocaliteLibre() {
		return localiteLibre;
	}
 
	public void setLocaliteLibre(String localiteLibre) {
		this.localiteLibre = localiteLibre;
	}
 
	public String getNoTelProf() {
		return noTelProf;
	}
 
	public void setNoTelProf(String noTelProf) {
		this.noTelProf = noTelProf;
	}
 
	public String getNoTelMobile() {
		return noTelMobile;
	}
 
	public void setNoTelMobile(String noTelMobile) {
		this.noTelMobile = noTelMobile;
	}
 
	public String getNoTelPrive() {
		return noTelPrive;
	}
 
	public void setNoTelPrive(String noTelPrive) {
		this.noTelPrive = noTelPrive;
	}
 
	public String getEmail() {
		return email;
	}
 
	public void setEmail(String email) {
		this.email = email;
	}
 
	public String getNoFax() {
		return noFax;
	}
 
	public void setNoFax(String noFax) {
		this.noFax = noFax;
	}
 
	public IdentiteService getM_identiteService() {
		return m_identiteService;
	}
 
	public void setM_identiteService(IdentiteService m_identiteService) {
		this.m_identiteService = m_identiteService;
	}
 
}
Qqun peut-il m'aider svp ?
merci d'avance