bonjour,
voici mon pb:

J'ai un formulaire contenant une liste de clients, chacun affichés sur une ligne a laquelle est associée un radio button permettant de sélectionner le client. Ensuite je passe dans mon Action et veut mettre l'id du client sélectionné en session pour l'afficher dans la jsp suivante.

Code de la jsp créant le formulaire:
(sachant que les value des html:radio sont correctes quand je regarde le source html généré)
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
 
<logic:iterate id="client_i" name="listeClientsForm" property="listeClients">
	<tr>
		<td>
			<bean:write name="client_i" property="id"/>
 
		</td>
		<td>
			<bean:write name="client_i" property="nom"/>
		</td>
		<td>
			<bean:write name="client_i" property="prenom"/>
		</td>
		<td>
			<bean:write name="client_i" property="secteur"/>
		</td>
		<td>
			<html-el:radio property="choix" value="${client_i.id}"/>
		</td>
	</tr>
</logic:iterate>

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
 
public class ListeClientsForm extends ActionForm
{
	private static final long serialVersionUID = 1L;
 
	private ArrayList<ElfClient> listeClients = new ArrayList<ElfClient>();
	private String[] choix = new String[1]; // id du client sélectionné
 
	public ArrayList getListeClients() {
		GestionClient gestionCli=new GestionClient();
		setListeClients( gestionCli.getClients() );
		return listeClients;
	}
 
	public void setListeClients(ArrayList<ElfClient> client) {
		this.listeClients = client;
	}
 
	public String getChoix(){
		return choix[0];
	}
 
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		listeClients = new ArrayList<ElfClient>();
		choix=new String[1];
	}
}
Voici la classe Action ou apparait le pb:
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
 
public class ListeClientsAction extends Action{
    public ActionForward execute( 	ActionMapping mapping,
            						ActionForm form,
            						HttpServletRequest request,
            						HttpServletResponse response)
            						throws Exception
    {
 
    		ListeClientsForm listeClientsForm = (ListeClientsForm)form;
 
    		request.getSession().getServletContext().setAttribute( "idUser", Integer.parseInt(listeClientsForm.getChoix()) );
    		//request.getSession().getServletContext().setAttribute( "idUser", 1 );
 
    		return mapping.findForward("success");
    }
 
}
En fait, le résultat de listeClientsForm.getChoix() est null mais je ne comprend pas pourquoi. Si quelqu'un a une idée ca serait gentil!

Merci