Bonjour,
pouvez vous m'aidez a trouver l erreur dans le scripte jsp (jdbc), j arrive pas a insérer les données dans ma bd access .
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<%
//
String nom=request.getParameter("nom");
String login=request.getParameter("login");
String pass=request.getParameter("pass");
String repass=request.getParameter("repass");
String req="INSERT INTO db3 VALUES ('"+nom+"','"+login+"','"+pass+"')";
Statement stmt;
Connection connexion;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
try {
connexion=DriverManager.getConnection("jdbc:odbc:db3");
stmt=connexion.createStatement();
int nbMaj = stmt.executeUpdate(req);
}
catch(Exception e){ System.out.println("Erreur: "+ e.getMessage());}
// catch (SQLException e){ System.out.println("Erreur de connecxion a la base de données");}
%>
<form id="form1" name="form1" method="post" action="tp.jsp">
<p> nom
<input name="nom" type="text" />
(*)</p>
<p> login
<input name="login" type="text" />
(*)</p>
<p> password
<input name="pass" type="password" id="pass" />
(*)</p>
<p> confirmer le motdepass
<input name="repass" type="password" id="repass" />
(*)</p>
<label>Envoyer
<input type="submit" name="Submit" value="Envoyer" />
</label>
<label>annuler
<input type="reset" name="Submit" value="annuler" />
</label>
</form>
</body>
</html>
Afficher la suite