Chaudement Bonjour
voila je n'arrive pas a afficher l'id d'une personne dans une page jsp comme celle ci
mon controller est bon puisqu'il affiche la bonne personne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page isELIgnored="false"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> .... <tr><td colspan="3" align="center"><h1>Fiche de compte : ${person.nom} ${person.prenom}</h1></td></tr> <tr><td width="100"><input type="button" value="Revocation" size="20"></td> <td> Nom :</td><td>${person.nom}</td></tr> <tr><td><a href="/projet/piece?action=modifClient&idClient=${person.nom}"><input type="button" value="Modifier" size="20"></a></td> <td width="100"> Prenom :</td><td>${person.prenom}</td></tr> <tr><td><a href="/projet/piece?action=listClient"><input type="button" value="Retour" size="20"></a></td> <td width="100"> Mail :</td><td>${person.mail}</td></tr> <tr><td></td><td width="100"> Droit :</td><td>${person.droit}</td></tr>
classe Client :
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 private void editClient(HttpServletRequest req, HttpServletResponse res) throws DBException, Exception{ String id; id=req.getParameter("idClient"); id="1"; if (id!=null){ Client p=(Client) monClient.find(id); if (p!=null){ req.setAttribute("person",p); redirect("editClient.jsp", req, res); } else redirect("listClient.jsp", req, res); } }
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 package fr.cassoto.Beans; import fr.cassoto.Bdd.DBException; public class Client extends ManipBd{ Integer id; String nom; String prenom; String mail; String mdp; int droit; public Client()throws DBException { super(); } public void setNom (String nom){ this.setAttribute("nom",nom); } public void setPrenom (String prenom){ this.setAttribute("prenom",prenom); } public void setMail (String mail){ this.setAttribute("mail",mail); } public void setMdp (String mdp){ this.setAttribute("mdp",mdp); } public void setDroit (int droit){ this.setAttribute("droit",String.valueOf(droit)); } public String getidClient (){ return this.getAttribute(this.getPrimary_key()); } public String getNom (){ return this.getAttribute("nom"); } public String getPrenom (){ return this.getAttribute("prenom"); } public String getMail (){ return this.getAttribute("mail"); } public String getMdp (){ return this.getAttribute("mdp"); } public int getDroit (){ return Integer.parseInt(this.getAttribute("droit")); } public String getNomComplet (){ return this.getAttribute("nom")+" "+this.getAttribute("prenom"); } }
Partager