salut

je travaille à relier struts avec hibernate comme suit:

la pageJSP projet.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
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Ajout des projets</title>
<html:javascript formName="projet"/>
</head>
<body>
<html:form action="/ajoutProjet" onsubmit="return validateProjet(this);">
<table>
<tr><td>Nom :</td><td><html:text property="nom"/></td></tr>
<tr><td>Date de début :</td><td><html:text property="dateDebut"/></tr>
<tr><td>Date de Fin :</td><td><html:text property="dateFin"/></td></tr>
<tr><td></td><td><html:submit value="ajouter"/><html:reset value="annuler"/></td></tr>
</table>
</html:form>
</body>
</html:html>
le fichier struts-config.xml:
Code xml : 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
<struts-config>
 
<form-beans>
<form-bean name="projet" type="struts.beans.BeanProjet"/>
</form-beans>
 
<action-mappings>
<action path="/projet" forward="/projet.jsp"/>
 
<action path="/ajoutProjet" input="/projet.jsp" scope="session"
name="projet" type="struts.actions.ActionProjet" validate="true">
      <forward name="succes" path="/resultatProjet.jsp" />
      <forward name="echec" path="/erreurProjet.jsp" />
</action>
</action-mappings>
<message-resources parameter="messages" />
 
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>

la classe java de DAO d'hibernate:
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
public class ProjetHome {
public boolean addProjet(Projet projet)
{
Transaction tx=null;
Session session=HibernateUtil.getSessionFactory().getCurrentSession();
try
{
tx=session.beginTransaction();
session.save(projet);
tx.commit();
return true;
}
catch(HibernateException e)
{
e.printStackTrace();
if(tx!=null && tx.isActive())
{
tx.rollback();
 
}
return false;
}
}
et enfin mon Action qui sert à faire le lien entre le contrôleur et la logique métier(dao d'hibernate) :

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
25
26
27
28
29
30
31
32
33
public class ActionProjet extends Action{
	public ActionForward execute(ActionMapping mapping, ActionForm form, 
            HttpServletRequest req, 
            HttpServletResponse res) throws Exception {
 
BeanProjet bp=(BeanProjet)form;
String nom,dd,df;
Date dateDebut=new Date();
Date dateFin=new Date();
nom=bp.getNom();
dd=bp.getDateDebut();
df=bp.getDateFin();
try{
	SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
	dateDebut=sdf.parse(dd);
	dateFin=sdf.parse(df);
}
catch(Exception e){
	mapping.findForward("echec");
}
Projet projet=new Projet();
projet.setNom(nom);
projet.setDateDebut(dateDebut);
projet.setDateFin(dateFin);
ProjetHome ph=new ProjetHome();
boolean b=false;
b=ph.addProjet(projet);
if(b)
	return mapping.findForward("succes");
else
	return mapping.findForward("echec");
}
}
j'exécute le projet alors que la page jsp s'affiche et la vérification avec struts ca marche bien mais après il m'apparait une erreur comme ceci:

java.lang.NoClassDefFoundError: org/hibernate/HibernateException
struts.actions.ActionProjet.execute(ActionProjet.java:44)
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
et aucune donnée n'est enregistrée dans la bd.

aidez-moi svp et merci d'avance.