bonjour
j'ai généré un formulaire en jsp et quand je rempli et je valide je trouve po les données dans la base
je c po koi faire j'arrive pas a trouvé le probléme
voila mon code jsp
<%@ page language="java" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.io.*;" %>
<%@ page import="Metier.*" %>
<%@page import="java.sql.*;" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Grille d'écoute_Inscrire utilisateur</title>
</head>
<body bgcolor="#D2DEE9">
<jsp:useBean id="p" class="Metier.Traitement"/>
<jsp:setProperty name="p" property="*"/>
<% int n = p.AjoutUtilisateur();%>
<form action ="ajouté.html" method="post" name="inscription" >
<table>
<tr>
<td>Fonction:</td>
<td><select>
<option> </option>
<% ResultSet res = p.AffichageFonction();%>
<% while (res.next()) {%>
<option value="'<%=res.getString("code_fonction")%>'"><%= res.getString("libelle_fonction")%></option>
<%}%>
</select></td>
</tr>
<tr>
<td>Contrat:</td>
<td><select>
<option> </option>
<% ResultSet rs = p.AffichageContrat();%>
<% while (rs.next()) {%>
<option value="'<%=rs.getString("code_contrat")%>'"><%= rs.getString("type")%></option>
<%}%>
</select></td>
</tr>
<tr>
<td>Opération:</td>
<td><select>
<option> </option>
<%ResultSet r = p.AffichageOperation();%>
<% while (r.next()) {%>
<option value="'<%=r.getString("code_operation")%>'" ><%= r.getString("nom_operation")%></option>
<%}%>
</select></td>
</tr>
<tr>
<td>Login:</td><td><input type="text" name="login"></td>
</tr>
<tr>
<td>Password:</td><td><input type="password" name="pass"></td>
</tr>
<tr>
<td>Profil:</td>
<td><select>
<option> </option>
<%ResultSet resl = p.AffichageProfil();%>
<% while (resl.next()) {%>
<option value="'<%=resl.getString("code_profil")%>'"><%= resl.getString("libelle_profil")%></option>
<%}%>
</select></td>
</tr>
</table>
<input type="submit" name="b_enr" value="Enregistrer">
</form>
</body>
</html>
et le code java ou il ya le traitement:
public static int AjoutUtilisateur(){
try{
Utilisateur u=new Utilisateur();
Connexion.chargement();
Connexion.Connection();
String requete13="insert into Utilisateur (code_fonction,login, password ,code_profil,code_contrat, code_operation )values('"+u.getCode_fonction()+"','"+u.getLogin()+"','"+u.getCode_profil()+"','"+u.getCode_contrat()+"','"+u.getCode_operation()+"')";
int n=Connexion.CreerStatement().executeUpdate(requete13);
return n;
}
catch(SQLException e13){
System.err.println(e13.getMessage());
return 0;
}
}
aidez moi svp