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
|
class:base donnée
public static ArrayList afficher(DataSource DS_GE ) throws SQLException,ClassNotFoundException
{
Connection con=DS_GE.getConnection();
Statement stmt=con.createStatement();
ResultSet rs;
ArrayList a= new ArrayList();
rs=stmt.executeQuery("SELECT * FROM test.tab_client ");
while (rs.next()) {
String nom = rs.getString("nom") ;
clientForm e=new clientForm();
e.setNom(nom);
a.add(e);
}
return a;
servlet:Action:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ArrayList a = new ArrayList();
DataSource DS_GE=this.getDS_GE();
HttpSession session = request.getSession();
//L =testjava.getClient(DS_GE);
a = testjava.afficher(DS_GE);
if(a != null){
session.setAttribute("allMyCustomers" , a);
}
return mapping.findForward(SUCCESS);
}
en fin: jsp:
<c:forEach var="ID_client" items="${allMyCustomers}" varStatus="vs">
${ID_client}
</c:forEach>
tout ça mais ya rien qui s'affiche?????? |
Partager