Bonjour a tous;
j'ai un problème avec ma liste déroulante. Je veux recuperer l'item selectionné mais j'y arrive pas voila le code .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 <p:dialog widgetVar="composeDlg" modal="true" header="Nouvelle reclamation" width="530" height="300" showEffect="fade" hideEffect="fade"> <h:form> <h:outputText value="Objet: "/> <p:selectOneListbox id="scroll" value="#{recBean.selectedType}" style="height:100px ;width:220px" > <f:selectItems var="a" id ="scrol" value="#{recBean.listTypeRec}" itemLabel="#{a.libelleTypeRec}" itemValue="#{a}"/> </p:selectOneListbox> <p:keyboard id="val" value="#{recBean.value}"/> <p:commandButton value="Send" actionListener="#{recBean.envoieRec}"/> <p:commandButton value="Cancel" onclick="composeDlg.hide()" type="button"/> </h:form> </p:dialog>
le code de recBean:
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 @ManagedBean(name="recBean") @SessionScoped public class ReclamationBean implements Serializable{ @ManagedProperty(value="#{reclamationService}") private RecService reclamationService; @ManagedProperty(value="#{loginBean}") private LoginBean loginBean; private TypeReclamation selectedType; @Autowired private List<TypeReclamation> listTypeRec; private Reclamation rec; public String value; public ReclamationBean() { } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public TypeReclamation getSelectedType() { return selectedType; } public void setSelectedType(TypeReclamation selectedType) { this.selectedType = selectedType; } public Reclamation getRec() { return rec; } public void setRec(Reclamation rec) { this.rec = rec; } public List<TypeReclamation> getListTypeRec() { return listTypeRec; } public void setListTypeRec(List<TypeReclamation> listTypeRec) { this.listTypeRec = listTypeRec; } public void envoieRec(ActionEvent actionEvent) { rec=new Reclamation(); rec.setIdAbonne(idAbonne); //System.out.println(idAbonne); //System.out.println( selectedType); rec.setIdTypeRec(selectedType.getIdTypeRec()); reclamationService.ajoutRec(rec); System.out.print("oketto"); } public LoginBean getLoginBean() { return loginBean; } public void setLoginBean(LoginBean loginBean) { this.loginBean = loginBean; } public void setReclamationService(RecService reclamationService) { this.reclamationService = reclamationService; } public RecService getReclamationService() { return reclamationService; } @PostConstruct public void extraireType () { listTypeRec = reclamationService.findTypeRec(); k =loginBean.k; idAbonne= k.getIdAbonne(); } public int getTyp() { return typ; } public void setTyp(int typ) { this.typ = typ; } Abonne k; public String nomAbonne; public int idAbonne; public int typ; public int getIdAbonne() { return idAbonne; } public void setIdAbonne(int idAbonne) { this.idAbonne = idAbonne; } public Abonne getK() { return k; } public void setK(Abonne k) { this.k = k; } public String getNomAbonne() { return nomAbonne; } public void setNomAbonne(String nomAbonne) { this.nomAbonne = nomAbonne; }
le but: l'envoie d'une réclamation par un client déjà authentifier alors il faut que j'enregistre cette réclamation avec l'id de abonné ainsi que l'id de type de la réclamation choisie.
merci d'avance
Partager