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 :

No getter method for property eleven of bean org.apache.struts.taglib.html.BEAN


Sujet :

Struts 1 Java

  1. #1
    Membre éclairé
    Inscrit en
    Juin 2007
    Messages
    328
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 328
    Par défaut No getter method for property eleven of bean org.apache.struts.taglib.html.BEAN
    j'ai rencontré cette erreur: No getter method for property eleven of bean org.apache.struts.taglib.html.BEAN

    ma classe EleveAjoutAction est la suivante:
    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
     
    package com.school.action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
     
    import com.school.model.Eleve;
    import com.school.model.Inscription;
    import com.school.presentation.form.EleveForm;
    import com.school.presentation.form.InscriptionForm;
    import com.school.presentation.util.Util;
    import com.school.service.EleveService;
    import com.school.service.InscriptionService;
     
    public class EleveAjoutAction extends Action {
     
              public ActionForward execute(
            		  ActionMapping mapping,
            		  ActionForm form,
            		  HttpServletRequest request,
            		  HttpServletResponse response) {
            	  EleveForm instance=(EleveForm)form;
            	  Eleve eleve=new Eleve();
            	  eleve.setEleven(instance.getEleven());
            	 try{
            	 eleve.setDATE_NAISSANCE(Util.stringToDate(instance.getDATE_NAISSANCE()));
            	 } catch (Exception e){
            		 System.out.println("Impossible de convertir");
            	 }
            	  eleve.setADRESSE_ELEVE(instance.getADRESSE_ELEVE());
            	  eleve.setLIEU_DE_NAISSANCE(instance.getLIEU_DE_NAISSANCE());
            	  eleve.setPRENOM_ELEVE(instance.getPRENOM_ELEVE());
            	  eleve.setANCIEN_ETABLISSEMENT(instance.getANCIEN_ETABLISSEMENT());
            	  eleve.setMALADIES(instance.getMALADIES());
            	  eleve.setMEDICAMENTS(instance.getMEDICAMENTS());
            	  eleve.setSEXE(instance.getSEXE());
            	  eleve.setNACADEMIQUE(instance.getNACADEMIQUE());
            	  eleve.setPHOTO(instance.getPHOTO());
            	  EleveService es=new EleveService();
            	  es.Ajoutereleve(eleve);
     
            	/*  InscriptionForm inscription=(InscriptionForm)form;
            	 Inscription insc=new Inscription();
            	 try{
            	 insc.setDATE_INSCRIPTION(Util.stringToDate(inscription.getDATEINSCRIPTION()));
            	 } catch (Exception e){
            		 System.out.println("Impossible de convertir");
            	 }
            	 
            	 InscriptionService ins=new InscriptionService();
            	 ins.Ajouterinscription(insc);*/
     
            	  return mapping.findForward("success");
              }
     
    }

    ma classe EleveForm est la suivante:
    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
     
    package com.school.presentation.form;
    import java.util.*;
    import org.apache.struts.action.ActionForm;
     
     
    public class EleveForm extends ActionForm {
     
     
     
    	   private Integer CODE_ELEVE;
    	   private String eleven;
    	   private String PRENOM_ELEVE;
    	   private String DATE_NAISSANCE;
    	   private String LIEU_DE_NAISSANCE;
    	   private String SEXE;
    	   private String ADRESSE_ELEVE;
    	   private String PHOTO;
    	   private String NACADEMIQUE;
    	   private String MALADIES;
    	   private String MEDICAMENTS;
    	   private String ANCIEN_ETABLISSEMENT;
    	public String getADRESSE_ELEVE() {
    		return ADRESSE_ELEVE;
    	}
    	public void setADRESSE_ELEVE(String adresse_eleve) {
    		ADRESSE_ELEVE = adresse_eleve;
    	}
    	public String getANCIEN_ETABLISSEMENT() {
    		return ANCIEN_ETABLISSEMENT;
    	}
    	public void setANCIEN_ETABLISSEMENT(String ancien_etablissement) {
    		ANCIEN_ETABLISSEMENT = ancien_etablissement;
    	}
    	public Integer getCODE_ELEVE() {
    		return CODE_ELEVE;
    	}
    	public void setCODE_ELEVE(Integer code_eleve) {
    		CODE_ELEVE = code_eleve;
    	}
    	public String getDATE_NAISSANCE() {
    		return DATE_NAISSANCE;
    	}
    	public void setDATE_NAISSANCE(String date_naissance) {
    		DATE_NAISSANCE = date_naissance;
    	}
    	public String getLIEU_DE_NAISSANCE() {
    		return LIEU_DE_NAISSANCE;
    	}
    	public void setLIEU_DE_NAISSANCE(String lieu_de_naissance) {
    		LIEU_DE_NAISSANCE = lieu_de_naissance;
    	}
    	public String getMALADIES() {
    		return MALADIES;
    	}
    	public void setMALADIES(String maladies) {
    		MALADIES = maladies;
    	}
    	public String getMEDICAMENTS() {
    		return MEDICAMENTS;
    	}
    	public void setMEDICAMENTS(String medicaments) {
    		MEDICAMENTS = medicaments;
    	}
    	public String getNACADEMIQUE() {
    		return NACADEMIQUE;
    	}
    	public void setNACADEMIQUE(String nacademique) {
    		NACADEMIQUE = nacademique;
    	}
     
     
    	public String getEleven() {
    		return eleven;
    	}
    	public void setEleven(String eleven) {
    		this.eleven = eleven;
    	}
    	public String getPHOTO() {
    		return PHOTO;
    	}
    	public void setPHOTO(String photo) {
    		PHOTO = photo;
    	}
    	public String getPRENOM_ELEVE() {
    		return PRENOM_ELEVE;
    	}
    	public void setPRENOM_ELEVE(String prenom_eleve) {
    		PRENOM_ELEVE = prenom_eleve;
    	}
    	public String getSEXE() {
    		return SEXE;
    	}
    	public void setSEXE(String sexe) {
    		SEXE = sexe;
    	}
     
     
    		}
    et enfin voici ma classe jsp, EleveSaisie.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
     
     
     
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
     
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
     
     
      <body>
        <html:form action="/eleveAjout" method="post" >
         <table border="0">
           <tr>
             <td>Nom elève :</td>
             <td><html:text property="eleven"/></td>
           </tr>
           <tr>
           <td>Prenom elève :</td>
             <td><html:text property="PRENOM_ELEVE"/></td>
           </tr>
           <tr>
    <td>Date de naissance :</td>
             <td><html:text property="DATE_NAISSANCE"/></td>       
           </tr>
          <tr>
              <td>Lieu de naissance :</td>
             <td><html:text property="LIEU_DE_NAISSANCE"/></td>
              </tr>  
         <tr>
         <td>Adresse :</td>
             <td><html:text property="ADRESSE_ELEVE"/></td>
     
         </tr>
         <tr>
         <td>Ancien etablissement :</td>
             <td><html:text property="ANCIEN_ETABLISSEMENT"/></td>
     
         </tr>
          <tr>
    <td>Maladies :</td>
             <td><html:text property="MALADIES"/></td>      
          </tr>
           <tr>
           <td>Médicaments :</td>
             <td><html:text property="MEDICAMENTS"/></td>
     
           </tr>
     
           <tr>
           <td>Sexe :</td>
             <td><html:text property="SEXE"/></td>
     
           </tr>
     
           <tr>
           <td>Photo :</td>
             <td><html:text property="PHOTO"/></td>
     
           </tr>
           <tr>
            <td>numero academique:</td>
             <td><html:text property="NACADEMIQUE"/></td>
             </tr>
     
                   <tr>
     
              <td colspan="2" align="center"><html:submit value="Enregistrer"/> </td>     
           </tr>
           </table>
        </html:form>
         </body>
    </html>
    merci infiniment d'avance.

  2. #2
    Membre Expert Avatar de willoi
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    1 355
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 355
    Par défaut
    Fais voir ton struts-config.xml

  3. #3
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    Dans le struts-config.xml, dans le mapping de l'Action de path /eleveAjout, as-tu bien référencé le form-bean de type EleveForm via l'attribut name ?

    Sinon, pour ne pas avoir de problème avec les autres propriétés de ton ActionForm, je te conseille de respecter les conventions de nommage Java.

  4. #4
    Membre éclairé
    Inscrit en
    Juin 2007
    Messages
    328
    Détails du profil
    Informations forums :
    Inscription : Juin 2007
    Messages : 328
    Par défaut
    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
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <!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 >
         <form-bean name="instance" type="com.school.presentation.form.EleveForm"/>
         <form-bean name="businstance" type="com.school.presentation.form.BusForm"/>
         <form-bean name="inscription" type="com.school.presentation.form.InscriptionForm"/>
      </form-beans>
     
     <action-mappings>
     <action 
        attribute="instance" 
        name="instance"
        path="/eleveAjout"
        scope="request"
        type="com.school.action.EleveAjoutAction" >
        <forward name="success" path="/ok.jsp"/> 
        </action>
     
     
    <action 
        attribute="businstance" 
        name="businstance"
        path="/BusAjout"
        scope="request"
        type="com.school.action.BusAjoutAction" >
        <forward name="success" path="/ok.jsp"/> 
        </action>
     
        <action 
        attribute="inscription" 
        name="inscription"
        path="/eleveAjout"
        scope="request"
        type="com.school.action.EleveAjoutAction" >
        <forward name="success" path="/ok.jsp"/> 
        </action>
     
     
        <action 
        path="/eleveListe" 
         attribute="instance"
        name="instance"
        type="com.school.action.EleveListAction" >
            <forward name="success" path="/eleveListe.jsp" />
        </action>
     
     
     
       </action-mappings>
         <message-resources parameter="com.school.struts.ApplicationResources" />
    </struts-config>

  5. #5
    Membre Expert Avatar de willoi
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    1 355
    Détails du profil
    Informations personnelles :
    Âge : 52
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 355
    Par défaut
    Citation Envoyé par c_nvy
    Sinon, pour ne pas avoir de problème avec les autres propriétés de ton ActionForm, je te conseille de respecter les conventions de nommage Java.
    Oui effectivement commence deja par mettre les proprietes de ton bean en miniscules

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 1
    Dernier message: 26/08/2010, 16h22
  2. Réponses: 2
    Dernier message: 24/08/2009, 16h56
  3. Réponses: 2
    Dernier message: 09/09/2008, 14h24
  4. Réponses: 2
    Dernier message: 09/08/2007, 16h36
  5. [Struts]No getter method for property xxx
    Par azpublic dans le forum Struts 1
    Réponses: 3
    Dernier message: 04/01/2006, 19h01

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