Bonjour,
je débute en developpement web et dans une servlet qui construit ma page j'ai un problème sur un champs SELECT
voici mon code
lorsque le out.println("<p>choix = " + choix + "</p>"); s'exécute il renvoi b par contre dans la liste déroulante c'est le choix 1 qui est sélectionné et non le choix 2
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 String choix = new String(""); String choixAnnu = request.getParameter("p_choix"); if (choixAnnu.equals("")){ choix = bundle.getString("choix"); } else { choix = choixAnnu; } out.println("<p>choix = " + choix + "</p>"); //affichage de la liste des choix out.println("<form name='Fchoix' method='post' >"); out.println("<select name='p_choix' onchange='changeChoix();'>"); if (choix.equals('s')){ out.println("<option value='s' selected>choix 1</option>"); } else { out.println("<option value='s'>choix 1</option>"); } if (choix.equals('b')){ out.println("<option value='b' selected>choix 2</option>"); } else { out.println("<option value='b'>choix 2</option>"); } out.println("</select>"); out.println("</form>");
Je ne vois pas l'erreur...
Merci pour votre aide.
Partager