Bonjour, j'ai une fonction qui va chercher des information en bdd

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
public ArrayList afficherLivres() 
    {
         ArrayList <Livre> al = new ArrayList <Livre> () ;
 
            try
            {
                Class.forName(driver);
                //Connexion a* la BDD//
                conn = DriverManager.getConnection(url, "root", "sam220889");
                stmt = (Statement) conn.createStatement();
 
                //Requete SQL//
                rs = stmt.executeQuery("select * from cataloguelivre");
 
                while(rs.next())
                {
                    String titreLivre = rs.getString(1);
                    String auteur = rs.getString(2);
                    int prixLivre = rs.getInt(3);
                    int stock = rs.getInt(4);
                    Livre livre = new Livre(titreLivre, auteur, prixLivre, stock);
                    al.add(livre);
                }
 
            }
            catch(SQLException exc)
            {
                System.out.println("SQLException : " + exc.getMessage());
                System.out.println("SQLState " + exc.getSQLState());
            }
            catch (ClassNotFoundException exc)
            {
                exc.printStackTrace();
            }
 
            return al ;
     }
j'ai une jsp sur laquelle j'affiche ces informations

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
Bdd bdd = new Bdd() ;
ArrayList <Livre> al = bdd.afficherLivres() ;
for (int i=0; i<al.size(); i++)
{
    out.println(al.get(i).getTitreLivre()) ;
}
Le problème est que seul la dernière entrée est affichée.

Quelqu'un peut m'aider svp.