Bonjour a tous,
je me permets de vous soumettre un problème que je n'arrive pas a résoudre en espérant que vous puissiez m'aider.

En fait, mon problème concerne jsp:useBean, j'utilise un bean que je nomme test, celui ci fonctionne tres bien, mais si j'utilise un nom different de test, plus rien ne fonctionne, alors que la logique est la meme :s

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
 
<%@ page import="java.util.*" %>
<%@ page import="mvc.*" %>
 
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=${encoding}">
        <title>Musixtore</title>
    </head>
    <jsp:useBean id="test" class="mvc.ListeCD" scope="request"></jsp:useBean>
    <body>
        <h2>Musixtore</h2>
        <hr/>
        <form method="POST">
            <select name="CD">
                <%
                   ArrayList<ListeCD> li = test.getListeCD();
                   ListIterator it = li.listIterator();
                   while(it.hasNext()){
                       ListeCD liste = (ListeCD)it.next();
                %>
 
                <option value="<%= liste.getId() %>">
                    <%= liste.getAlbum() %> | <%= liste.getArtiste() %> | <%= liste.getPrix() %>
                </option>
 
                <%
                   }
                %>
            </select>
            <input type="text" name="quantité" value="1" size="1"/>
            <input type="submit" name="ajouter" value="Ajouter au panier" />
        </form>
 
    </body>
</html>
Voila la source de ma page jsp, et voici l'erreur lorsque je change le nom de du bean :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
exception
 
javax.servlet.ServletException: java.lang.InstantiationException: class mvc.ListeCD : java.lang.InstantiationException: mvc.ListeCD
 
root cause
 
java.lang.InstantiationException: class mvc.ListeCD : java.lang.InstantiationException: mvc.ListeCD
Merci d'avance pour vos réponses