bonjours tous le monde,
j'ai une page jsp qui fait l'affichage sous forme d'un tableau dynamique la liste des clients a partir d'un table Client et dans chaque ligne se trouve un forme a la quelle on peut choisir entre modifier et supprimer le champ correspondant.
pour cela j'ai essayer avec le code suivante:
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
<table border="0" cellpadding="0" cellspacing="0" align="center" width="1006" height="228">
     <tr>
     <th>login</th>
     <th>pass</th>
     <th>nom</th>
     <th>prenom</th>
     <th>email</th>
     <th>genre</th>
     <th>date inscription</th>
     <th>operation</th>
     </tr>
     <%    
        for(int k=0;k<vv.size();k++)
        {%>
  	<tr>
      <td align="center"><%=a[k].getLogin() %></td>
      <td align="center"><%=a[k].getPass()%></td>
      <td align="center"><%=a[k].getNom()%></td>
      <td align="center"><%=a[k].getPrenom()%></td>
      <td align="center"><%=a[k].getEmail()%></td>
      <td align="center"><%=a[k].getGenre()%></td>
      <td align="center"><%=a[k].getDateInscri().toString()%></td>
      <td align="center"><html:form action="/consclient">
			<html:select property="op" name="op" value="choisir tache"><html:option key="modification" value="modification" /><html:option key="suppression" value="suppression" />
			<%request.getSession().setAttribute("v",a[k].getLogin()); %></html:select><html:errors property="op"/>
			<html:submit/>
		</html:form>  </td>
 
            </tr>
      <%} %>
mais le code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
<%request.getSession().setAttribute("v",a[k].getLogin()); %>
envoie le login du dernier client (et c'est evident) comment je peut modifier mon code, pour qu'il fonctionne correctement ???
voila la methode ActionForward execute(..) de la classe action:
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
public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ConsclientForm consclientForm = (ConsclientForm) form;
		String op=consclientForm.getOp();
		ClientDAO cdao=new ClientDAO();
		List vv=cdao.findAll();
		//Client c=new Client();
		String ht=(String)request.getSession().getAttribute("v");
		if(op.equals("modification"))
				return mapping.findForward("ok");
		else
		{
			cdao.delete(cdao.findById(ht));
			return mapping.findForward("nonok");
		}
	}
merci à tous .