Bonjour , je suis débutante en jsf et jpa. Bon je suis entrain de réaliser un site web e-commerce et je veux récupérer les données de la base dans un formulaire mais lors de l’exécution de la page xhtml ,il m'affiche des erreurs.
voici mon code:

code xhtml:

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
<h:selectOneMenu value="#{categorieBean.idCat}">
                <f:selectItems  value="#{categorieBean.CatMap}" 
                      />     
                    </h:selectOneMenu>

code 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
package net.sispay.BeanNew;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
 
import net.sispay.Bean.dao.DaoCategorie;
import net.sispay.model.Categorie;
 
 
 
@ManagedBean
@SessionScoped
public class CategorieBean {
	private Long idCat;
	private String descriptionCategorie;
	private Map<String,Long> CatMap;
    private List<Categorie> toutes_les_cat;
	public String getDescriptionCategorie() {
		return descriptionCategorie;
	}
	public void setDescriptionCategorie(String descriptionCategorie) {
		this.descriptionCategorie = descriptionCategorie;
	}
 
	public Map<String, Long> getCatMap() {
		return CatMap;
	}
	public void setCatMap(Map<String, Long> catMap) {
		CatMap = catMap;
	}
	@PostConstruct
	public void init(){
		/*toutes_les_cat=   new DaoCategorie().findAll();
	for(Categorie c:toutes_les_cat)
		System.out.println(c.getDescriptionCategorie());*/
 
		CatMap=new HashMap<String,Long>();
		toutes_les_cat=   new DaoCategorie().findAll();   
		int i=0;
		while(i<toutes_les_cat.size())
		{
		CatMap.put(toutes_les_cat.get(i).getDescriptionCategorie(),toutes_les_cat.get(i).getId());
		i++;	
		}
 
	}
 
 
	public Long getIdCat() {
		return idCat;
	}
	public void setIdCat(Long idCat) {
		this.idCat = idCat;
	}
	public List<Categorie> getToutes_les_cat() {
		return toutes_les_cat;
	}
	public void setToutes_les_cat(List<Categorie> toutes_les_cat) {
		this.toutes_les_cat = toutes_les_cat;
	}
	public void findAll(){
 
		toutes_les_cat=   new DaoCategorie().findAll();
 
 
 
	}
 
 
 
}
code DAO:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
public List<Categorie> findAll(){
		Query query = em.createQuery("select c from Categorie c");
		return (List<Categorie>) query.getResultList();
	}
l'erreur est la suivante:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
javax.el.PropertyNotFoundException: /page/Demande.xhtml @45,25 value="#{categorieBean.CatMap}": Property 'CatMap' not found on type net.sispay.BeanNew.CategorieBean
Merci d'avance pour votre aide.