i need to create a new Panne so this is the jsp:
creerPan.jsp:
Code:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ page contentType="text/html; charset=iso-8859-1" language="java"
import="java.util.*,managers.*,forms.*"
errorPage=""%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%
ReparateurManager Rmanager = new ReparateurManager();
List Rlist1 = (List) Rmanager.getListReparateur();
request.setAttribute("Rlist", Rlist1);
%>
<html>
<head>
<title>Creer Nouveau Panne</title>
</head>
<body>
<html:form action="ajoutPan" >
<center>
<h1><u>Création d'un nouveau Panne</u></h1>
</center>
<div>
<table border="1" bordercolor="#FFF1BF" bgcolor="#FFFDE6" >
<tr>
<td width="169" height="21" bgcolor="#FFF5D7"><div align="left" class="style8">Matricule :</div></td>
<td width="227" bgcolor="#FFF5D7"><html:text property="idPan" /></td>
</tr>
<tr>
<td bgcolor="#FFF5D7"><div align="left" class="style8">Déscription :</div></td>
<td bgcolor="#FFF5D7"><html:text property="descPan" /></td>
</tr>
<tr>
<td bgcolor="#FFF5D7"><div align="left" class="style8">Date de panne :</div></td>
<td bgcolor="#FFF5D7"><html:text property="datePan" /></td>
</tr>
<tr>
<td bgcolor="#FFF5D7"><div align="left" class="style8">Réparateur :</div></td>
<html:select property="reparateurs">
<html:optionsCollection property="Rlist" value="desRep" label="Réparateurs"/>
</html:select>
</tr>
</table>
<br>
<CENTER><html:submit property="operation">
<bean:message key="operation.creerPan" />
</html:submit>
<html:reset>reset</html:reset> </CENTER>
</div>
</html:form>
</body>
</html>
this is the panne manager:
PanneManager.javaCode:
package managers;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import forms.PanneForm;
import util.HibernateUtil;
public class PanneManager {
private boolean rep=false;
private boolean rep1 = false;
public boolean trouve(){
return rep;
}
public boolean trouve1() {
return rep1;
}
public List getListPanne() {
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
List result = session.createQuery("from PanneForm as P order by P.idPan").list();
session.getTransaction().commit();
session.close();
return result;
}
public void creerPan(PanneForm Pan) {
Transaction tx = null;
Session session = HibernateUtil.getSessionFactory().openSession();
try {
tx = session.beginTransaction();
session.save(Pan);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
if (tx != null && tx.isActive())
tx.rollback();
} finally {
session.flush();
session.close();
}
}
}
this is the Reparateur manager:
ReparateurManager.javaCode:
package managers;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import forms.ReparateurForm;
import util.HibernateUtil;
public class ReparateurManager { private boolean rep=false;
private boolean rep1 = false;
public boolean trouve(){
return rep;
}
public boolean trouve1() {
return rep1;
}
public List getListReparateur() {
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
List result = session.createQuery("from ReparateurForm as R order by R.idRep").list();
session.getTransaction().commit();
session.close();
return result;
}
public void creerRep(ReparateurForm Rep) {
Transaction tx = null;
Session session = HibernateUtil.getSessionFactory().openSession();
try {
tx = session.beginTransaction();
session.save(Rep);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
if (tx != null && tx.isActive())
tx.rollback();
} finally {
session.flush();
session.close();
}
}
}
struts-config.xmlCode:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans type="org.apache.struts.action.ActionFormBean">
<form-bean name="fournisseurForm" type="forms.FournisseurForm" />
<form-bean name="panneForm" type="forms.PanneForm" />
<form-bean name="materielForm" type="forms.MaterielForm" />
<form-bean name="reparateurForm" type="forms.ReparateurForm" />
</form-beans>
<action-mappings type="org.apache.struts.action.ActionMapping">
<action path="/ajoutPan" type="actions.PanneAction"
scope="request" name="panneForm" parameter="operation"
input="/vues/creerPan.jsp" validate="false">
<forward name="succes" path="/vues/listePan.jsp"
redirect="true" />
</action>
</action-mappings>
<message-resources parameter="ApplicationResource" />
</struts-config>
but when i run the application i have this error:
Etat HTTP 500 -
--------------------------------------------------------------------------------
type Rapport d'exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
org.apache.jasper.JasperException: Exception in JSP: /vues/creerPan.jsp:85
82: <tr>
83: <td bgcolor="#FFF5D7"><div align="left" class="style8">Matériels :</div></td>
84: <html:select property="materiels">
85: <html:optionsCollection property="Mlist" value="refMat" label="Materiels"/>
86: </html:select>
87: </tr>
88: <tr>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
cause mère
javax.servlet.ServletException: No getter method for property Mlist of bean org.apache.struts.taglib.html.BEAN
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.vues.creerPan_jsp._jspService(creerPan_jsp.java:150)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
cause mère
javax.servlet.jsp.JspException: No getter method for property Mlist of bean org.apache.struts.taglib.html.BEAN
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)
org.apache.struts.taglib.html.OptionsCollectionTag.doStartTag(OptionsCollectionTag.java:219)
org.apache.jsp.vues.creerPan_jsp._jspx_meth_html_005foptionsCollection_005f0(creerPan_jsp.java:341)
org.apache.jsp.vues.creerPan_jsp._jspx_meth_html_005fselect_005f0(creerPan_jsp.java:310)
org.apache.jsp.vues.creerPan_jsp._jspx_meth_html_005fform_005f0(creerPan_jsp.java:201)
org.apache.jsp.vues.creerPan_jsp._jspService(creerPan_jsp.java:140)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/5.5.29.
--------------------------------------------------------------------------------