bonjour,
j ai une erreur que je n arrive pas a resoudre.
voici mon codeNo getter method for property nomcamion of bean idListCamion
celui de la servlet
celui du bean CamionBean
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 try{ PreparedStatement stmt = conn.prepareStatement("SELECT * FROM Camion");//envoi la cmd sql rs = stmt.executeQuery(); ArrayList listCamion = new ArrayList() ; while ( rs.next() ) { CamionBean camionBean = new CamionBean() ; String nomcam = rs.getString("NomCamion") ; String tel = rs.getString("NumTel"); camionBean.setNomCamion(nomcam); camionBean.setNumTel(tel); listCamion.add(camionBean) ; } request.setAttribute("listcamion",listCamion); getServletContext().getRequestDispatcher("/gestioncamion.jsp").forward(request,response);//envoie vers la page GestionCamion }catch(Exception e) //gestion erreur liste camion { out.println("<h1 align='center'>Erreur de connection à la base de donnée camion"); out.println("<h1 align='center'>information complementaire:"+e.getMessage() +"</h1>"); out.println("</body>"); out.println("</html>"); out.close(); }
et de l affichage gestioncamion.jsp
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 package testco; import java.io.Serializable; import java.util.*; public class CamionBean implements Serializable { private String nomcamion; private String numtel; public void setNomCamion(String nomcamion) { this.nomcamion = nomcamion; } public void setNumTel(String numtel) { this.numtel = numtel; } public String getNomCamion() { return nomcamion; } public String getNumTel() { return numtel; } }
ca doit etre une erreur toute bete de casse avec "nomcamion" mais j arrive pas a la voir... mais je suis pas sur!
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 <jsp:useBean id="listCamion" scope="request" class="testco.CamionBean" type="testco.CamionBean"/> <center><table width="60%" border="1"> <tr> <td><b><center>Selection</center></b></td> <td><b><center>Nom du camion</center></b></td> <td><b><center>Numero de telephone</center></b></td> </tr> <logic:iterate id="idListCamion" name="listcamion" scope="request"> <tr> <td width="11%"><center><input type="checkbox" name="composant"></center></td> <td width="30%"><bean:write name="idListCamion" property="nomcamion"/></td> <td width="30%"><bean:write name="idListCamion" property="numtel"/></td> </tr> </logic:iterate> </table></center>
Partager