Bonjour tout le monde;
Mon problème est le suivant,j'ai 5 radio bouton ,un champs texte et un bouton,je veux que lorseque je selectionne les radio boutons et à partir d'un clic du bouton j'execute une methode dans le bean,le resultats est affiché dans le champs texte que j'ai.pour moi le calcul se fait et il s'affiche dans le textbox mais les radio boutons que l'utilisateur a selectionné ne le sont,je veux que les radio boutons mémorise le choix de l'utilisateur.
Voilà le code de ma page
ma classe 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
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 <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ; width: 49% ;heignt:60;height: 18px;" > <legend></legend> <h:outputText value=" A. " styleClass="csstext" style="font-weight: bold;color: #D11B4C;"/> <h:inputText value="#{collaborateurBean.descriptionObjectifA}" styleClass="csstext" style="font-weight: bold; width:95%;color: #D11B4C;border-color:white;border-width:0px;" /> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center" > <input type="radio" class="radio" value="1" name="A"> </input> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="2" name="A"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="3" name="A"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="4" name="A" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="5" name="A"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ; width: 49% ;heignt:60;height: 18px;" > <legend></legend> <h:outputText value=" B. " styleClass="csstext" style="font-weight: bold;color: #D11B4C;"/> <h:inputText value="#{collaborateurBean.descriptionObjectifB}" styleClass="csstext" style="font-weight: bold; width:95%;color: #D11B4C;border-color:white;border-width:0px;" /> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="1" name="B"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="2" name="B"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="3" name="B"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="4" name="B"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="5" name="B"/> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ; width: 49% ;heignt:60;height: 18px;" > <legend></legend> <h:outputText value=" C. " styleClass="csstext" style="font-weight: bold;color: #D11B4C;"/> <h:inputText value="#{collaborateurBean.descriptionObjectifC}" styleClass="csstext" style="font-weight: bold; width:95%;color: #D11B4C;border-color:white;border-width:0px;" /> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="1" name="C" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="2" name="C" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="3" name="C" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="4" name="C" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="5" name="C" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ; width: 49% ;heignt:60;height: 18px;" > <legend></legend> <h:outputText value=" D. " styleClass="csstext" style="font-weight: bold;color: #D11B4C;"/> <h:inputText value="#{collaborateurBean.descriptionObjectifD}" styleClass="csstext" style="font-weight: bold; width:95%;color: #D11B4C;border-color:white;border-width:0px;" /> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="1" name="D" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="2" name="D" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="3" name="D" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="4" name="D" /> </div> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ;width: 5%;" > <legend></legend> <div align="center"> <input type="radio" class="radio" value="5" name="D" /> </div> </fieldset> <fieldset style="background:white ; border-color:white; border-style: solid ;float: left ; width: 49% ;heignt:60;height: 18px;" > <legend></legend> <h:commandButton value="Valider" action="#{collaborateurBean.calculScoreI}" > </h:commandButton> </fieldset> <fieldset style="background:white ; border-color:#243287; border-style: solid ;float: left ; width: 34% ;heignt:60;height: 18px;" > <legend></legend> <h:outputText value=" SCORE I : ( A + B + C + D ) =" styleClass="csstext" style="font-weight: bold;color: #243287;"/> <h:outputText id="scoreI" value=" #{collaborateurBean.scoreI} " styleClass="csstext" style="font-weight: bold; width:10%;color: #D11B4C;border-color:white;border-width:0px;" /> <h:outputText value=" / 4" styleClass="csstext" style="font-weight: bold;color: #243287;"/> </fieldset>
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 @SuppressWarnings("serial") @Component("collaborateurBean") @Scope("session") public class CollaborateurBean extends BaseManagedBean{ private @Autowired HttpServletRequest request; private String descriptionObjectifA,descriptionObjectifB,descriptionObjectifC,descriptionObjectifD; Double scoreI; Double scoreII; Double scoreIII; //CALCUL DE SCORE I public void calculScoreI(){ Double note=0.0; int n=0; System.out.println("entre dans calculScoreI"); System.out.println("entre dans calculScoreI"+descriptionObjectifA); if(!descriptionObjectifA.equals("")){ note=Double.parseDouble(request.getParameter("A")); n=n+1; } if(!descriptionObjectifB.equals("")){ note=note+Double.parseDouble(request.getParameter("B")); n=n+1; } if(!descriptionObjectifC.equals("")){ note=note+Double.parseDouble(request.getParameter("C")); n=n+1; } if(!descriptionObjectifD.equals("")){ note=note+Double.parseDouble(request.getParameter("D")); n=n+1; } note=note/n; scoreI=note; System.out.println("score I : "+note); } }
Partager