Comment modifier un enregistrement de la base de donnée

Titim86 Messages postés 7 Date d'inscription lundi 25 mai 2009 Statut Membre Dernière intervention 17 avril 2010 - 17 avril 2010 à 12:46
Titim86 Messages postés 7 Date d'inscription lundi 25 mai 2009 Statut Membre Dernière intervention 17 avril 2010 - 17 avril 2010 à 20:27
Bonjour tt le monde
Je suis une débutante en J2EE(j'utilise Struts 1 + Oracle),et je souhaite votre aide.Mon problème c'est que je veux modifier dans la base de données: j'ai une page JSP dans laquelle je récupère les propriétés d'un "utilisateur", j'ai utilisé pour cela la balise ainsi ma page JSP contient un lien pour exécuter l'action de modification, mais lorsque j'en clique dessus j'obtient l'erreur:ORA-01722: Nombre non valide.A l'aide d'un system.out.println(), j'ai découvert que mon Form ne récupère rien(toutes les proprités sont null).Svp j'attend votre aide et merci d'avance.

2 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 131
17 avril 2010 à 12:54
Salut,

Sans voir ton code, on pourras pas faire grand chose pour toi.
______________________________________

AVANT de poster votre message, veuillez lire, comprendre, et appliquer notre réglement
0
Titim86 Messages postés 7 Date d'inscription lundi 25 mai 2009 Statut Membre Dernière intervention 17 avril 2010
17 avril 2010 à 20:27
salut,
voici ma page jsp: la "listIntervenant_moral2" est un retour d'un autre fonction de recherche;en fait mon but est de modifier les propriétés d'un intervenant après un recherche.

<html:form action="/main" method="post" >

<center>
<label>

</label>

<logic:notEmpty name="listIntervenant_moral2" scope="request">

<logic:iterate id=\"ChercherForm\" name=\"listIntervenant_moral2\" scope=\"request\">
----

<label>

</label>,
<label>
" name="ChercherForm" property="denomination_arabe">

</label>,

,
<label></label>
<label>
" name="ChercherForm" property="denomination_français">
</label>,

----

<label>

</label>,
<label>
"name="ChercherForm" property="acronyme">
</label>,
,
<label>
" name="ChercherForm" property="categorie">

</label>,

----

<label>

</label>,
<label>
" name="ChercherForm" property="telephone">
</label>,

,
<label></label>
<label>
" name="ChercherForm" property="adresse">
</label>,

----

<label>

</label>,
<label>
"name="ChercherForm" property="capital">
</label>,

,
<label>
"name="ChercherForm" property="patente">
</label>,

----

,
<label>
"name="ChercherForm" property="observation_intervenant">
</label>,

,
<label>
" name="ChercherForm" property="fax">
</label>,
<label></label>,

</logic:iterate>

</logic:notEmpty>



</center>
<center>
<label>
<html:link action="/MODIFIER?do=modifier" paramId="ID" paramName="ChercherForm" paramProperty="ID"> Enregistrer</html:link>

Struts-cnfig

<form-bean name="DetailmoralForm" type="ma.ancfcc.form.Chercher_moralForm"></form-bean>
<forward name="success1" path="/pages/success.jsp">

Ma classe Action:Chercher_intervenant_moralAction:


public ActionForward modifier (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {

int ID=Integer.parseInt(request.getParameter("ID"));
System.out.println("hahwa"+ID);
Chercher_moralForm recherche1form= (Chercher_moralForm) form;
Intervenant_moDao intervenant2=new Intervenant_moDao();

Intervenant_moral intervenant1=new Intervenant_moral();


intervenant1.setAcronyme(recherche1form.getAcronyme());
intervenant1.setAdresse(recherche1form.getAdresse());
intervenant1.setCapital(recherche1form.getCapital());
intervenant1.setCategorie(recherche1form.getCategorie());
intervenant1.setDenomination_arabe(recherche1form.getDenomination_arabe());
intervenant1.setDenomination_français(recherche1form.getDenomination_français());
intervenant1.setFax(recherche1form.getFax());
intervenant1.setPatente(recherche1form.getPatente());
intervenant1.setObservation_intervenant(recherche1form.getObservation_intervenant());
intervenant1.setTelephone(recherche1form.getTelephone());
intervenant1.setID(recherche1form.getID());
intervenant2.modifier(intervenant1, ID) ;

intervenant2.modifier(intervenant1, ID);



return mapping.findForward("success1");
}

La classe IntervenantDao contient la méthode modifier:
public void modifier(Intervenant_moral form,int ID)
{ ResultSet rs=null;
try{
Statement stmt = con.createStatement();

System.out.print("update intervenant_morale set denomination_arabe='"+form.getDenomination_arabe()+"',denomination_francais='"+form.getDenomination_français()+"',adresse='"+form.getAdresse()+"',telephone='"+form.getTelephone()+"',fax='"+form.getFax()+"',categorie='"+form.getCategorie()+"',observation='"+form.getObservation_intervenant()+"',acronyme='"+form.getAcronyme()+"',patente='"+form.getPatente()+"',capital='"+form.getCapital()+"' where ID='"+ID+"'");
stmt.executeUpdate("update intervenant_morale set denomination_arabe='"+form.getDenomination_arabe()+"',denomination_francais='"+form.getDenomination_français()+"',adresse='"+form.getAdresse()+"',telephone='"+form.getTelephone()+"',fax='"+form.getFax()+"',categorie='"+form.getCategorie()+"',observation='"+form.getObservation_intervenant()+"',acronyme='"+form.getAcronyme()+"',patente='"+form.getPatente()+"',capital='"+form.getCapital()+"' where ID='"+ID+"'");

}catch(SQLException e)
{
e.printStackTrace();
}

Merci d'avance
0
Rejoignez-nous