Struts

Struts - Java - Programmation

Marsh Posté le 18-08-2010 à 15:58:51    

Bonjour,
j'ai besoin d'aide SVP,comme je suis débutant en Struts je veux réalise un projet pour évolué mes compétences.
dans mon projet j'ai 2 formulaires le 1er pour l'inscription d'un candidat et le 2eme formulaire pour la création de CV,
donc lorsque  je remplis les champs du 1er formulaire pour faire l'inscription du candidat j'ai l'erreur suivante:
 
exception
 
javax.servlet.ServletException: javax.servlet.ServletException: BeanUtils.populate
 org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
...
 
cause mère
 
javax.servlet.ServletException: BeanUtils.populate
 org.apache.struts.util.RequestUtils.populate(RequestUtils.java:475)
 org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50)
 org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60)
...
 
cause mère
 
java.lang.IllegalArgumentException: argument type mismatch
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
...
 
 
voici mes ressource:
 
inscrire_candidat.jsp:

Code :
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2. pageEncoding="ISO-8859-1"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <%@taglib prefix="html" uri="http://struts.apache.org/tags-html"%>
  5. <%@taglib prefix="logic" uri="http://struts.apache.org/tags-logic"%>
  6. <%@taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%>
  7. <html:html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  10. <title>Insert title here</title>
  11. </head>
  12. <body>
  13. <html:form action="/creer_cv">
  14. <table align="center">
  15.  <tr>
  16.   <td>Civilite</td>
  17.   <td>Nom</td>
  18.   <td>Prenom</td>
  19.  </tr>
  20.  <tr>
  21.   <td>
  22.   <html:select property="civilite" name="candidat" >
  23.   <html:option value="Mme"/>
  24.   <html:option value="Mlle"/>
  25.   <html:option value="Mr"/>
  26.   </html:select>
  27.   </td>
  28.   <td><html:text property="nomCnd" name="candidat" /></td>
  29.   <td><html:text property="prenomCnd" name="candidat" /></td>
  30.  </tr>
  31.  <tr>
  32.   <td>Date Naissance</td>
  33.   <td>Ville</td>
  34.   <td>Pays</td>
  35.  </tr>
  36.  <tr>
  37.   <td><html:text property="dateNaissanceCnd" name="candidat" /></td>
  38.   <td><html:text property="villeCnd" name="candidat" /></td>
  39.   <td><html:text property="paysCnd" name="candidat" /></td>
  40.  </tr>
  41.  <tr>
  42.   <td colspan="3">Adresse</td>
  43.  </tr>
  44.  <tr style="height: 37px;">
  45.   <td colspan="3"><html:textarea property="adresseCnd"
  46.    name="candidat" style=" width : 484px;" /></td>
  47.  </tr>
  48.  <tr>
  49.   <td>Tél Portable</td>
  50.   <td>Tél Fixe</td>
  51.   <td>Code Postale</td>
  52.  </tr>
  53.  <tr>
  54.   <td><html:text property="telPortanleCnd" name="candidat" /></td>
  55.   <td><html:text property="telFixeCnd" name="candidat" /></td>
  56.   <td><html:text property="codePostale" name="candidat" /></td>
  57.  </tr>
  58.  <tr>
  59.   <td colspan="3">Photo</td>
  60.  </tr>
  61.  <tr>
  62.   <td colspan="3"><html:file property="photo" name="candidat"
  63.    style=" width : 444px;" /></td>
  64.  </tr>
  65.  <tr>
  66.   <td colspan="3">Identifiants ITrecrute</td>
  67.  </tr>
  68.  <tr>
  69.   <td colspan="3">
  70.   <table>
  71.    <tr>
  72.     <td>E-mail</td>
  73.     <td>Confirmation E-mail</td>
  74.    </tr>
  75.    <tr>
  76.     <td><html:text property="emailCnd" name="candidat" /></td>
  77.     <td><html:text property="emailCnd" /></td>
  78.    </tr>
  79.    <tr>
  80.     <td>Mot de Passe</td>
  81.     <td>Confirmation Mot de Passe</td>
  82.    </tr>
  83.    <tr>
  84.     <td><html:text property="motPasseCnd" name="candidat" /></td>
  85.     <td><html:text property="motPasseCnd" /></td>
  86.    </tr>
  87.   </table>
  88.   </td>
  89.  </tr>
  90.  <tr>
  91.   <td colspan="3" align="right"><html:submit
  92.    value="Créer Mon Compte" /></td>
  93.  </tr>
  94. </table>
  95. </html:form>
  96. </body>
  97. </html:html>


 
Candidat.java

Code :
  1. package modeles_candidat;
  2. // Generated 29 juil. 2010 14:21:09 by Hibernate Tools 3.2.2.GA
  3. import java.util.HashSet;
  4. import java.util.Set;
  5. import javax.servlet.http.HttpServletRequest;
  6. import org.apache.struts.action.ActionErrors;
  7. import org.apache.struts.action.ActionForm;
  8. import org.apache.struts.action.ActionMapping;
  9. import modeles_generale.Civilite;
  10. import modeles_recruteur.Offre;
  11. /**
  12. * Candidat generated by hbm2java
  13. */
  14. public class Candidat extends ActionForm implements java.io.Serializable {
  15. /**
  16.  *  
  17.  */
  18. private static final long serialVersionUID = 1L;
  19. private int idCandidat;
  20. private String nomCnd;
  21. private String prenomCnd;
  22. private String dateNaissanceCnd;
  23. private String adresseCnd;
  24. private String telFixeCnd;
  25. private String telPortanleCnd;
  26. private String villeCnd;
  27. private String paysCnd;
  28. private String codePostale;
  29. private String emailCnd;
  30. private String motPasseCnd;
  31. private String dateInscription;
  32. private String dateConnexion;
  33. private int etatCompte;
  34. private Civilite civilite;
  35. private Set<AlertOffre> alertOffres = new HashSet<AlertOffre>();
  36. private Set<Offre> offres = new HashSet<Offre>();
  37. private String photo;
  38. public Candidat() {
  39. }
  40. public Candidat(String nomCnd, String prenomCnd, String dateNaissanceCnd,
  41.   String adresseCnd, String telFixeCnd, String telPortanleCnd,
  42.   String villeCnd, String paysCnd, String emailCnd,
  43.   String motPasseCnd, String dateInscription, String dateConnexion,
  44.   int etatCompte, String titreCv, String dateCreationCv,
  45.   String codePostale, Set<AlertOffre> alertOffres, Set<Offre> offres) {
  46.  this.nomCnd = nomCnd;
  47.  this.prenomCnd = prenomCnd;
  48.  this.dateNaissanceCnd = dateNaissanceCnd;
  49.  this.adresseCnd = adresseCnd;
  50.  this.telFixeCnd = telFixeCnd;
  51.  this.telPortanleCnd = telPortanleCnd;
  52.  this.villeCnd = villeCnd;
  53.  this.codePostale = codePostale;
  54.  this.paysCnd = paysCnd;
  55.  this.emailCnd = emailCnd;
  56.  this.motPasseCnd = motPasseCnd;
  57.  this.dateInscription = dateInscription;
  58.  this.dateConnexion = dateConnexion;
  59.  this.etatCompte = etatCompte;
  60.  this.alertOffres = alertOffres;
  61.  this.offres = offres;
  62. }
  63. public int getIdCandidat() {
  64.  return this.idCandidat;
  65. }
  66. public void setIdCandidat(int idCandidat) {
  67.  this.idCandidat = idCandidat;
  68. }
  69. public String getNomCnd() {
  70.  return this.nomCnd;
  71. }
  72. public void setNomCnd(String nomCnd) {
  73.  this.nomCnd = nomCnd;
  74. }
  75. public String getPrenomCnd() {
  76.  return this.prenomCnd;
  77. }
  78. public void setPrenomCnd(String prenomCnd) {
  79.  this.prenomCnd = prenomCnd;
  80. }
  81. public String getDateNaissanceCnd() {
  82.  return this.dateNaissanceCnd;
  83. }
  84. public void setDateNaissanceCnd(String dateNaissanceCnd) {
  85.  this.dateNaissanceCnd = dateNaissanceCnd;
  86. }
  87. public String getAdresseCnd() {
  88.  return this.adresseCnd;
  89. }
  90. public void setAdresseCnd(String adresseCnd) {
  91.  this.adresseCnd = adresseCnd;
  92. }
  93. public String getTelFixeCnd() {
  94.  return this.telFixeCnd;
  95. }
  96. public void setTelFixeCnd(String telFixeCnd) {
  97.  this.telFixeCnd = telFixeCnd;
  98. }
  99. public String getTelPortanleCnd() {
  100.  return this.telPortanleCnd;
  101. }
  102. public void setTelPortanleCnd(String telPortanleCnd) {
  103.  this.telPortanleCnd = telPortanleCnd;
  104. }
  105. public String getVilleCnd() {
  106.  return this.villeCnd;
  107. }
  108. public void setVilleCnd(String villeCnd) {
  109.  this.villeCnd = villeCnd;
  110. }
  111. public void setCodePostale(String codePostale) {
  112.  this.codePostale = codePostale;
  113. }
  114. public String getCodePostale() {
  115.  return codePostale;
  116. }
  117. public String getPaysCnd() {
  118.  return this.paysCnd;
  119. }
  120. public void setPaysCnd(String paysCnd) {
  121.  this.paysCnd = paysCnd;
  122. }
  123. public String getEmailCnd() {
  124.  return this.emailCnd;
  125. }
  126. public void setEmailCnd(String emailCnd) {
  127.  this.emailCnd = emailCnd;
  128. }
  129. public String getMotPasseCnd() {
  130.  return this.motPasseCnd;
  131. }
  132. public void setMotPasseCnd(String motPasseCnd) {
  133.  this.motPasseCnd = motPasseCnd;
  134. }
  135. public String getDateInscription() {
  136.  return this.dateInscription;
  137. }
  138. public void setDateInscription(String dateInscription) {
  139.  this.dateInscription = dateInscription;
  140. }
  141. public String getDateConnexion() {
  142.  return this.dateConnexion;
  143. }
  144. public void setDateConnexion(String dateConnexion) {
  145.  this.dateConnexion = dateConnexion;
  146. }
  147. public int getEtatCompte() {
  148.  return this.etatCompte;
  149. }
  150. public void setEtatCompte(int etatCompte) {
  151.  this.etatCompte = etatCompte;
  152. }
  153. public Set<AlertOffre> getAlertOffres() {
  154.  return this.alertOffres;
  155. }
  156. public void setAlertOffres(Set<AlertOffre> alertOffres) {
  157.  this.alertOffres = alertOffres;
  158. }
  159. public Civilite getCivilite() {
  160.  return civilite;
  161. }
  162. public void setCivilite(Civilite civilite) {
  163.  this.civilite = civilite;
  164. }
  165. public void setOffres(Set<Offre> offres) {
  166.  this.offres = offres;
  167. }
  168. public Set<Offre> getOffres() {
  169.  return offres;
  170. }
  171. public void setPhoto(String photo) {
  172.  this.photo = photo;
  173. }
  174. public String getPhoto() {
  175.  return photo;
  176. }
  177. }


 
Civilite.java

Code :
  1. package modeles_generale;
  2. // Generated 29 juil. 2010 14:31:12 by Hibernate Tools 3.2.2.GA
  3. /**
  4. * Civilite generated by hbm2java
  5. */
  6. public class Civilite implements java.io.Serializable {
  7. /**
  8.  *  
  9.  */
  10. private static final long serialVersionUID = 1L;
  11. private int idCivilite;
  12. private String libelleCivilite;
  13. public Civilite() {
  14. }
  15. public Civilite(String libelleCivilite) {
  16.  this.libelleCivilite = libelleCivilite;
  17. }
  18. public int getIdCivilite() {
  19.  return this.idCivilite;
  20. }
  21. public void setIdCivilite(int idCivilite) {
  22.  this.idCivilite = idCivilite;
  23. }
  24. public String getLibelleCivilite() {
  25.  return this.libelleCivilite;
  26. }
  27. public void setLibelleCivilite(String libelleCivilite) {
  28.  this.libelleCivilite = libelleCivilite;
  29. }
  30. }



stutrs-config.xml

Code :
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
  3.                                "http://struts.apache.org/dtds/struts-config_1_3.dtd">
  4. <struts-config>
  5. <data-sources/>
  6. <form-beans>
  7.   <form-bean name="candidat" type="modeles_candidat.Candidat"/>
  8.   <form-bean name="civilite" type="modeles_generale.Civilite"/>
  9. </form-beans>
  10. <global-exceptions/>
  11. <global-forwards/>
  12. <action-mappings>
  13.   <action parameter="/inscription_candidat.jsp"
  14.    path="/inscription_candidat" type="org.apache.struts.actions.ForwardAction"/>
  15.   <action name="candidat" path="/creer_cv"
  16.    scope="session" type="actions_candidat.Inscription_candidat">
  17.    <forward name="succes" path="/creer_cv.jsp"></forward>
  18.    </action>
  19. </action-mappings>
  20. <controller/>
  21. </struts-config>


je crois que le problème viens du champs civilite
Merci d'avance.

Reply

Marsh Posté le 18-08-2010 à 15:58:51   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed