bonjour , je suis débutante en jsf dans mon code je veux changer la liste des société selon la spécialité choisi mais il me donne un erreur .voici mon code.
code xhtml:
page 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 <h:selectOneMenu value="#{societeBean.idSpec}" onchange="#{societeBean.changer}" > <f:selectItems value="#{specialiteBean.specMap}" /> </h:selectOneMenu> </div> </h:form><br /><br /> <h:form id="form"> <p:dataTable style="width: 500px" headerClass="header" var="societe" value="#{societeBean.toutes_les_sos}" styleClass="table"> <p:column> <h:selectBooleanCheckbox value="true" /> </p:column> <p:column> <f:facet name="header"> ID </f:facet> <h:outputText value="#{societe.id}" styleClass="t" /> </p:column> <p:column> <f:facet name="header"> Societe </f:facet> <h:outputText value="#{societe.raisonSociale}" /> </p:column> </p:dataTable>
page DAO:
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 public class SocieteBean{ private Long idSos; private List<Societe> toutes_les_sos; private int idSpec; private String raisonSociale; public String getRaisonSociale() { return raisonSociale; } public int getIdSpec() { return idSpec; } public void setIdSpec(int idSpec) { this.idSpec = idSpec; } public void setRaisonSociale(String raisonSociale) { this.raisonSociale = raisonSociale; } public Long getIdSos() { return idSos; } public void setIdSos(Long idSos) { this.idSos = idSos; } public List<Societe> getToutes_les_sos() { return toutes_les_sos; } public void setToutes_les_sos(List<Societe> toutes_les_sos) { this.toutes_les_sos = toutes_les_sos; } @PostConstruct public void init(){ toutes_les_sos= new DaoSociete().findAll(); } public void changer(){ toutes_les_sos.clear(); toutes_les_sos=new DaoSociete().findByIdSpecialite(idSpec); } }
erreur:
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 public List<Societe> findAll(){ Query query = em.createQuery("select c from Societe c"); return (List<Societe>) query.getResultList(); } public List<Societe> findByIdSpecialite(int IdSpecialite){ try { Query query = em.createQuery("select c from Societe c where c.SPECIALITE_ID=:id"); query.setParameter("id", IdSpecialite); return (List<Societe>) query.getResultList(); }catch(Exception e){ e.printStackTrace(); return null; } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 javax.el.PropertyNotFoundException: /page/Demande.xhtml @43,88 onchange="#{societeBean.changer}": Property 'changer' not found on type net.sispay.BeanNew.SocieteBean
Partager