Problème d'insertion jsp/oracle
Salut me voici de retour avec un autre problème!
dans le cadre de l'application que je developpe j'ai une classe FormationInitiale dans laquelle j'ai ecri une methode pour faire une insertion dans ma base voici le code :
Code:
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
|
import java.util.*;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.SQLException;
public class FormationInitiale
{
...
private Connexion conex;
Connection con = conex.getConn();
...
public FormationInitiale()
{
this.NumFormation = 0;
this.Diplome = "";
this.Lieu = "";
this.DateDiplome = null;
this.Etablissement = "";
}
public void InsertFormationInitiale(String Diplome, String Lieu, Date Datediplome, String Etablissement) throws SQLException
{
try
{
Statement stat = con.createStatement(); // Création et initialisation du statement.
int res;
//Requete d'ajout de la formation initiale
String req = "INSERT INTO FORMATIONINITIALE (DIPLOME, LIEU, DATEDIPLOME, ETABLISSEMENT)"+
"VALUES("+Diplome+", "+DateDiplome+", "+Lieu+", "+Etablissement+");";
res = stat.executeUpdate(req);
con.commit();
System.out.println(res+" Insertion reussie!!");
}
catch(SQLException e) { e.printStackTrace(); }
}
...
} //End Class FORMATIONINITIALE |
Avec cette methode je veux inseré des données provenant d'un formulare dont le code est ci après
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<table width="100%" class="tbcamoufle" height="100%">
<tr>
<td class = "tdleft">Diplôme</td>
<td class = "tdleft"><input name="diplome" type="text" class="inputtext" /></td>
</tr>
<tr>
<td class = "tdleft">Date d'obtention</td>
<td><input name="datediplome" type="text" maxlength="50" class="inputdate" /></td>
</tr>
<tr>
<td class = "tdleft">Lieu de formation </td>
<td><input name="lieuformation" type="text" maxlength="50" class="inputtext" /></td>
</tr>
<tr>
<td class = "tdleft">Etablissement de formation </td>
<td><input name="etablissement" type="text" maxlength="50" class="inputtext" /></td>
</tr>
</table> |
sur la page de validation de ce formulaire j'ai :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<%@ page import="gestionformation.*" %>
<%
FormationInitiale fi = new FormationInitiale();
Statement stat = con.createStatement(); // Création et initialisation du statement.
//Données de la formation initiale
String Diplome = request.getParameter("diplome");
String DateDiplome = request.getParameter("datediplome");
String LieuFormation = request.getParameter("lieuformation");
String Etablissement = request.getParameter("etablissement");
//Requete d'ajout de la formation initiale
String req1 = "INSERT INTO FORMATIONINITIALE (DIPLOME, LIEU, DATEDIPLOME, ETABLISSEMENT)" +
" VALUES("+Diplome+", "+DateDiplome+", "+LieuFormation+", "+Etablissement+");";
int insertReq1 = stat.executeUpdate(req1);*/
fi.InsertFormationInitiale(Diplome, LieuFormation, stringToDate(DateDiplome, "dd/mm/aaaa"), Etablissement)
%> |
La fonction stringToDate(String ladate, String leformat) me pertmet de convertir une chaine de caractère en date que trouvé sur le net. Lorsque j'execute j'ai cette erreur!
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP
Une erreur s'est produite à la ligne: 4 dans le fichier jsp: /ajoutagentvalid.jsp
Erreur de servlet générée:
C:\Documents and Settings\Léon SAMAKE\.netbeans\5.0\jakarta-tomcat-5.5.9_base\work\Catalina\localhost\GestionFormation\org\apache\jsp\ajoutagentvalid_jsp.java:127: cannot find symbol
symbol : method stringToDate(java.lang.String,java.lang.String)
location: class org.apache.jsp.ajoutagentvalid_jsp
fi.InsertFormationInitiale(Diplome, LieuFormation, stringToDate(DateDiplome, "dd/mm/aaaa"), Etablissement);
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:246)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) |
JE ne vois pas ce qui cloche! Merci d'avance!