Bonjour,

j'ai une classe connection.java et un fichier index.jsp

connection.java
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
import java.sql.*;
import java.io.*;
 
public class connection {
    Connection con = null;
    ResultSet resultats = null;
    String err="", requete = "" , pilote="com.mysql.jdbc.Driver" , url="jdbc:mysql://localhost/dynhmi";
 
    connection(){ // constructeur
        try {
            Class.forName(pilote).newInstance();
        } catch (Exception e) {
            err="Impossible de charger le pilote jdbc pour mySQL";
        }
        try {
            con = DriverManager.getConnection(url, "root", "123456");
        } catch (Exception e) {
            err+=", Connection non effectué ! ";
        }
    }
    public String GetErr(){ // méthode
        return err;
    }
}
index.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
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,com.lamelcolor.*" %>
<!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=UTF-8">
        <title>JSP Page</title>
        <LINK rel="stylesheet" type="text/css" href="common/style.css">
    </head>
    <body>      
        <div id="menu"><jsp:include page="common/menu.jsp"></jsp:include></div>
        <div id="content">        
            <%--   <jsp:include page="home.jsp"></jsp:include> --%>
            <% connection con=new connection();
            out.println(con.GetErr());%>
 
        </div>
        <div id="footer">
            A developpement of Lamelcolor SA and Logico SA
        </div>
 
    </body>
</html>
A chaque fois j'ai l'erreur suivante:
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP

Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /index.jsp
Erreur de servlet générée:
C:\Documents and Settings\fabrice\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\dynhmi\org\apache\jsp\index_jsp.java:63: cannot find symbol
symbol : class connection
location: class org.apache.jsp.index_jsp
connection con=new connection();
^


Une erreur s'est produite à la ligne: 16 dans le fichier jsp: /index.jsp
Erreur de servlet générée:
C:\Documents and Settings\fabrice\.netbeans\5.5\apache-tomcat-5.5.17_base\work\Catalina\localhost\dynhmi\org\apache\jsp\index_jsp.java:63: cannot find symbol
symbol : class connection
location: class org.apache.jsp.index_jsp
connection con=new connection();
^
2 errors
Et pourtant j'arrive à compiler...

Je ne comprends pas..