Récupération de données dans une formulaire JSP à partir de la base
bonjour,
je suis entrain de réaliser une application avec JSP/Servlet et Mysql.dans mon formulaire JSP je veux afficher les données enregistrés dans la base dans une table. mais lorsque j'execute le programme il me donne l'erreur suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11
|
org.apache.jasper.JasperException: An exception occurred processing JSP page /Central/site.jsp at line 59
<%
ArrayList list =new ArrayList();
list=(ArrayList)request.getAttribute("maListe");
Iterator monIterator=list.iterator();
while(monIterator.hasNext()){
site Site =(site)monIterator.next();
%> |
voici mon code:
[COLOR="rgb(255, 140, 0)"]Site.jsp:[/COLOR]
Code:
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
|
<table border='2' style="margin-left: 600px;font-size: 20px;font-family: cursive;color: blue" bordercolor="#09A7F5" >
<tr>
<td>site</td>
<td>téléphone</td>
<td>abrégé</td>
</tr>
<%
ArrayList list =new ArrayList();
list=(ArrayList)request.getAttribute("maListe");
Iterator monIterator=list.iterator();
while(monIterator.hasNext()){
site Site =(site)monIterator.next();
%>
<tr>
<td><%=Site.getLibelle() %> </td>
<td><%=Site.getNumero() %></td>
<td><%=Site.getDirect() %></td>
</tr>
<%
}
%>
</table> |
[COLOR="rgb(255, 140, 0)"]Site.java[/COLOR]
Code:
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
|
package Model;
public class site {
private String libelle;
private int numero;
private int direct;
public String getLibelle() {
return libelle;
}
public void setLibelle(String libelle) {
this.libelle = libelle;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public int getDirect() {
return direct;
}
public void setDirect(int direct) {
this.direct = direct;
}
public site( String libelle, int numero, int direct) {
super();
this.libelle = libelle;
this.numero = numero;
this.direct = direct;
}
public site() {
super();
// TODO Auto-generated constructor stub
}
} |
Servlet afficher.java
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ArrayList <site> liste =new ArrayList<site>();
liste=DaoSite.listeSite();
request.setAttribute("maListe", liste);
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher("./site.jsp");
rd.forward(request,response);
} |
je sais pas comment résolu ce problem??