IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Struts 1 Java Discussion :

java.lang.IllegalArgumentException: Null property value for 'civilite'


Sujet :

Struts 1 Java

  1. #1
    Futur Membre du Club
    Inscrit en
    Décembre 2008
    Messages
    9
    Détails du profil
    Informations forums :
    Inscription : Décembre 2008
    Messages : 9
    Points : 6
    Points
    6
    Par défaut java.lang.IllegalArgumentException: Null property value for 'civilite'
    Bonjour,
    j'ai besoin d'aide svp ,j'ai un problème que je n'arrive pas à le résoudre
    j'ai un formulaire pour l'inscription (inscription_candidat.jsp) et un autre formulaire pour créer le CV (creer_cv.jsp)
    donc quand je remplis les informations du 1er formulaire et je veux passer au 2eme pour créer le CV 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)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
    ...

    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)
    org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
    org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)

    voici mes ressources:

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

    Candidat.java

    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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
     
    package modeles_candidat;
     
    // Generated 29 juil. 2010 14:21:09 by Hibernate Tools 3.2.2.GA
     
    import java.util.HashSet;
    import java.util.Set;
     
    import javax.servlet.http.HttpServletRequest;
     
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
     
    import modeles_generale.Civilite;
     
    import modeles_recruteur.Offre;
     
    /**
     * Candidat generated by hbm2java
     */
    public class Candidat extends ActionForm implements java.io.Serializable {
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	private int idCandidat;
    	private String nomCnd;
    	private String prenomCnd;
    	private String dateNaissanceCnd;
    	private String adresseCnd;
    	private String telFixeCnd;
    	private String telPortanleCnd;
    	private String villeCnd;
    	private String paysCnd;
    	private String codePostale;
    	private String emailCnd;
    	private String motPasseCnd;
    	private String dateInscription;
    	private String dateConnexion;
    	private int etatCompte;
    	private Civilite civilite;
    	private Set<AlertOffre> alertOffres = new HashSet<AlertOffre>();
    	private Set<Offre> offres = new HashSet<Offre>();
    	private String photo;
     
     
    	public Candidat() {
    	}
     
    	public Candidat(String nomCnd, String prenomCnd, String dateNaissanceCnd,
    			String adresseCnd, String telFixeCnd, String telPortanleCnd,
    			String villeCnd, String paysCnd, String emailCnd,
    			String motPasseCnd, String dateInscription, String dateConnexion,
    			int etatCompte, String titreCv, String dateCreationCv,
    			String codePostale, Set<AlertOffre> alertOffres, Set<Offre> offres) {
    		this.nomCnd = nomCnd;
    		this.prenomCnd = prenomCnd;
    		this.dateNaissanceCnd = dateNaissanceCnd;
    		this.adresseCnd = adresseCnd;
    		this.telFixeCnd = telFixeCnd;
    		this.telPortanleCnd = telPortanleCnd;
    		this.villeCnd = villeCnd;
    		this.codePostale = codePostale;
    		this.paysCnd = paysCnd;
    		this.emailCnd = emailCnd;
    		this.motPasseCnd = motPasseCnd;
    		this.dateInscription = dateInscription;
    		this.dateConnexion = dateConnexion;
    		this.etatCompte = etatCompte;
    		this.alertOffres = alertOffres;
    		this.offres = offres;
    	}
     
    	public int getIdCandidat() {
    		return this.idCandidat;
    	}
     
    	public void setIdCandidat(int idCandidat) {
    		this.idCandidat = idCandidat;
    	}
     
    	public String getNomCnd() {
    		return this.nomCnd;
    	}
     
    	public void setNomCnd(String nomCnd) {
    		this.nomCnd = nomCnd;
    	}
     
    	public String getPrenomCnd() {
    		return this.prenomCnd;
    	}
     
    	public void setPrenomCnd(String prenomCnd) {
    		this.prenomCnd = prenomCnd;
    	}
     
    	public String getDateNaissanceCnd() {
    		return this.dateNaissanceCnd;
    	}
     
    	public void setDateNaissanceCnd(String dateNaissanceCnd) {
    		this.dateNaissanceCnd = dateNaissanceCnd;
    	}
     
    	public String getAdresseCnd() {
    		return this.adresseCnd;
    	}
     
    	public void setAdresseCnd(String adresseCnd) {
    		this.adresseCnd = adresseCnd;
    	}
     
    	public String getTelFixeCnd() {
    		return this.telFixeCnd;
    	}
     
    	public void setTelFixeCnd(String telFixeCnd) {
    		this.telFixeCnd = telFixeCnd;
    	}
     
    	public String getTelPortanleCnd() {
    		return this.telPortanleCnd;
    	}
     
    	public void setTelPortanleCnd(String telPortanleCnd) {
    		this.telPortanleCnd = telPortanleCnd;
    	}
     
    	public String getVilleCnd() {
    		return this.villeCnd;
    	}
     
    	public void setVilleCnd(String villeCnd) {
    		this.villeCnd = villeCnd;
    	}
     
    	public void setCodePostale(String codePostale) {
    		this.codePostale = codePostale;
    	}
     
    	public String getCodePostale() {
    		return codePostale;
    	}
     
    	public String getPaysCnd() {
    		return this.paysCnd;
    	}
     
    	public void setPaysCnd(String paysCnd) {
    		this.paysCnd = paysCnd;
    	}
     
    	public String getEmailCnd() {
    		return this.emailCnd;
    	}
     
    	public void setEmailCnd(String emailCnd) {
    		this.emailCnd = emailCnd;
    	}
     
    	public String getMotPasseCnd() {
    		return this.motPasseCnd;
    	}
     
    	public void setMotPasseCnd(String motPasseCnd) {
    		this.motPasseCnd = motPasseCnd;
    	}
     
    	public String getDateInscription() {
    		return this.dateInscription;
    	}
     
    	public void setDateInscription(String dateInscription) {
    		this.dateInscription = dateInscription;
    	}
     
    	public String getDateConnexion() {
    		return this.dateConnexion;
    	}
     
    	public void setDateConnexion(String dateConnexion) {
    		this.dateConnexion = dateConnexion;
    	}
     
    	public int getEtatCompte() {
    		return this.etatCompte;
    	}
     
    	public void setEtatCompte(int etatCompte) {
    		this.etatCompte = etatCompte;
    	}
     
    	public Set<AlertOffre> getAlertOffres() {
    		return this.alertOffres;
    	}
     
    	public void setAlertOffres(Set<AlertOffre> alertOffres) {
    		this.alertOffres = alertOffres;
    	}
     
    	public Civilite getCivilite() {
    		return civilite;
    	}
     
    	public void setCivilite(Civilite civilite) {
    		this.civilite = civilite;
    	}
     
    	public void setOffres(Set<Offre> offres) {
    		this.offres = offres;
    	}
     
    	public Set<Offre> getOffres() {
    		return offres;
    	}
     
    	public void setPhoto(String photo) {
    		this.photo = photo;
    	}
     
    	public String getPhoto() {
    		return photo;
    	}
     
    }
    Civilite.java:
    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
    34
    35
    36
    37
    38
    39
    40
    41
     
    package modeles_generale;
     
    // Generated 29 juil. 2010 14:31:12 by Hibernate Tools 3.2.2.GA
     
    /**
     * Civilite generated by hbm2java
     */
    public class Civilite implements java.io.Serializable {
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	private int idCivilite;
    	private String libelleCivilite;
     
    	public Civilite() {
    	}
     
    	public Civilite(String libelleCivilite) {
    		this.libelleCivilite = libelleCivilite;
    	}
     
    	public int getIdCivilite() {
    		return this.idCivilite;
    	}
     
    	public void setIdCivilite(int idCivilite) {
    		this.idCivilite = idCivilite;
    	}
     
    	public String getLibelleCivilite() {
    		return this.libelleCivilite;
    	}
     
    	public void setLibelleCivilite(String libelleCivilite) {
    		this.libelleCivilite = libelleCivilite;
    	}
     
    }

    struts-config.xml:

    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
                                   "http://struts.apache.org/dtds/struts-config_1_3.dtd">
    <struts-config>
     <data-sources/>
     <form-beans>
      <form-bean name="candidat" type="modeles_candidat.Candidat"/>
      <form-bean name="civilite" type="modeles_generale.Civilite"/>
     </form-beans>
     <global-exceptions/>
     <global-forwards/>
     <action-mappings>
      <action parameter="/inscription_candidat.jsp"
       path="/inscription_candidat" type="org.apache.struts.actions.ForwardAction"/>
      <action name="candidat" path="/creer_cv"
       scope="session" type="actions_candidat.Inscription_candidat">
       <forward name="succes" path="/creer_cv.jsp"></forward>
       </action>
     </action-mappings>
     <controller/>
    </struts-config>

  2. #2
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391
    Points : 15 059
    Points
    15 059
    Par défaut
    Salut,

    Utilises un type String ou Integer pour ton civilité et c'est dans la classe Action que tu manipules sa valeur pour le mettre dans la classe entité.
    Évites d'utiliser de type complexe comme date, ... dans la ActionForm. Perso, je n'utilise que des types qui ne poseront pas de problème de casting (String, Integer,Double,...) et des collections dans mes ActionForm.

    A+.

Discussions similaires

  1. Réponses: 3
    Dernier message: 14/03/2011, 17h12
  2. Réponses: 9
    Dernier message: 10/12/2010, 13h55
  3. Réponses: 1
    Dernier message: 26/01/2010, 14h25
  4. java.lang.IllegalArgumentException: vendorName == null!
    Par spax dans le forum API standards et tierces
    Réponses: 8
    Dernier message: 16/10/2008, 11h47
  5. Réponses: 9
    Dernier message: 03/06/2007, 21h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo