Bonjour,
Je dois récupérer le contenu d'une table dans ma base de données dans une liste déroulante, j'arrive à charger cela et ma liste est bien remplie, le problème c'est que quand je choisis un Item et je valide j'ai l'erreur suivante qui s'affiche :
Mais j'ai besoin de récupérer l'id de typeprofil pour pouvoir le stoker dans la table profil voilà le contenu de mon bean :ATTENTION: /profilDetail.jsp(19,4) '#{typeProfilBean.currentTypeProfil.getIdtypeprofil}' Target Unreachable, 'currentTypeProfil' returned null
org.apache.jasper.el.JspPropertyNotFoundException: /profilDetail.jsp(19,4) '#{typeProfilBean.currentTypeProfil.getIdtypeprofil}' Target Unreachable, 'currentTypeProfil' returned null
Et la déclaration dans jsf est la suivante :
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 public class TypeProfilBean { @Autowired private transient TypeProfilService typeProfilService; private transient HtmlScrollableDataTable typeProfilTable; Typeprofil currentTypeProfil; private List<Typeprofil> typeProfilList; private List<SelectItem> selectProfil = new ArrayList<SelectItem>(); @PostConstruct public void initTypeProfil() { typeProfilList = typeProfilService.findAllTypeProfil(); } public List<Typeprofil> recupererProfils() { typeProfilList = typeProfilService.findAllTypeProfil(); return typeProfilList; } public List<SelectItem> getSelectProfil() { selectProfil.clear(); typeProfilList = recupererProfils(); for (Typeprofil currentTypeProfil : typeProfilList) { selectProfil.add(new SelectItem(currentTypeProfil.getIdtypeprofil(), currentTypeProfil.getLibelletypeprofil())); } return selectProfil; } public void setSelectProfil(List<SelectItem> selectProfil) { this.selectProfil = selectProfil; } public Typeprofil getCurrentTypeProfil() { return currentTypeProfil; } public void setCurrentTypeProfil(Typeprofil currentTypeProfil) { this.currentTypeProfil = currentTypeProfil; } public List<Typeprofil> getTypeProfilList() { return typeProfilList; } public void setTypeProfilList(List<Typeprofil> typeProfilList) { this.typeProfilList = typeProfilList; }
Même en mettant <h:selectOneMenu value="#{typeProfilBean.currentTypeProfil.getIdtypeprofil}"> il me renvoie la même erreur en disant que currentprofil renvoie null.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <h:selectOneMenu value="# {typeProfilBean.currentTypeProfil.getIdtypeprofil}"> <f:selectItems value="#{typeProfilBean.selectProfil}"/> </h:selectOneMenu>
Partager