IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

Ne pas désélectionner un bouton radio


Sujet :

JSF Java

  1. #1
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Août 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 40
    Par défaut Ne pas désélectionner un bouton radio
    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
    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>
    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
     
    @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);
     
    	}
    }

  2. #2
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Août 2012
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 40
    Par défaut
    c'est résolu!j'ai utilisé <f:ajax>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. CSS pour ne pas griser les bouton radio en mode 'disabled'
    Par niko73 dans le forum Mise en page CSS
    Réponses: 10
    Dernier message: 16/01/2009, 10h05
  2. [PHP-JS] prb bouton radio ne se désactivant pas
    Par faucon54 dans le forum Langage
    Réponses: 14
    Dernier message: 30/05/2007, 08h26
  3. [Mail] email ne reprenant pas la case coché d'un bouton radio
    Par zazapirouette dans le forum Langage
    Réponses: 25
    Dernier message: 23/05/2007, 16h30
  4. bouton radio coché ou pas?
    Par franfr57 dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 19/04/2007, 14h59
  5. boutons radio pas beau et sélection de ligne
    Par Virgile le chat dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 26/11/2006, 10h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo