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 :

select dynamique : No getter method available


Sujet :

Struts 1 Java

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 25
    Points : 18
    Points
    18
    Par défaut select dynamique : No getter method available
    bonjour,
    je travail avec myeclipse et je veux faire une select dynamique mais elle ne marche pas
    bon voila mon code dans la page jsp:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <bean:define id="ids" property="lesChoix" value="lesChoix" /> 
    <html:select property="typeUtil">
       <html:options collection="ids" property="value" labelProperty="label" /> 
    </html:select>
    et dans la page actionForm :
    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
     
    /** type property */
    private String typeUtil;
     
    /** nom property */
    private String nom;
    ArrayList lesChoix = new ArrayList(); 
     
    public void reset(ActionMapping mapping, HttpServletRequest request) { 
      // initialisation de la liste des articles de la liste déroulante 
      this.lesChoix.clear(); 
      /* 
      * remplir la list:lesChoix, a partir de la base de données 
       */ 
      lesChoix.add(new LabelValueBean("admin", "Administrateur" )); 
      lesChoix.add(new LabelValueBean("biblio", "Biblothecaire" )); 
      lesChoix.add(new LabelValueBean("util", "Utilisateur" )); 
    }
    /** 
    * @return Returns the lesChoix. 
    */ 
    public ArrayList getLesChoix() { 
           return lesChoix; 
    } 
     
    /** 
    * @param lesChoix The lesChoix to set. 
    */ 
    public void setLesChoix(ArrayList lesChoix) { 
    	this.lesChoix = lesChoix; 
    }
    /** 
    * Returns the type.
    * @return String
    */
    public String getTypeUtil() {
    	return typeUtil;
    }
     
    /** 
    * Set the type.
    * @param type The type to set
    */
    public void setTypeUtil(String type) {
    	this.typeUtil = type;
    }
    donc j ai mis tous les getter donc j ai besoin mais voila j ai l'erreur suivante :
    org.apache.jasper.JasperException: Exception in JSP: /ajoutAdmin.jsp:37

    34: Confirmer mot de passe : <html:password property="mp2"/><br/>
    35: Choisir le role :
    36: <bean:define id="ids" property="lesChoix" value="lesChoix" />
    37: <html:select property="typeUtil">
    38: <html:options collection="ids" property="value" labelProperty="label" />
    39: </html:select>

    cause mère

    javax.servlet.ServletException: No getter method available for property typeUtil for bean under name org.apache.struts.taglib.html.BEAN

    aider moi plz

  2. #2
    Expert éminent

    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
    Points : 7 778
    Points
    7 778
    Par défaut
    As-tu mis le tag html:select dans un tag html:form ?
    Modératrice Java - Struts, Servlets/JSP, ...

  3. #3
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 25
    Points : 18
    Points
    18
    Par défaut
    oui
    voila le code complet de ma page 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
     
     <body>
    Inscription :<br>
    <html:form action="/inscriptions">
    	Identifiant : <html:text property="id"/><br/>
    	Nom : <html:text property="nom"/><br/>
    	Mot de passe : <html:password property="mp"/><br/>
    	Confirmer mot de passe : <html:password property="mp2"/><br/>
    	Choisir le role : 
    	<bean:define id="ids" property="lesChoix" value="lesChoix" /> 
    	<html:select property="typeUtil" multiple="false">
    		<html:options collection="ids" property="value" labelProperty="label" /> 
    	</html:select>
     
    <html:submit value="Valider"/><br>
    </html:form>
    </body>

  4. #4
    Expert éminent

    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
    Points : 7 778
    Points
    7 778
    Par défaut
    et dans le mapping de l'Action de path /inscriptions, tu as bien mis l'attribut name="nomDuFormBean" qui correspond à l'ActionForm dans laquelle il y a getter et setter sur la propriété typeUtil ?
    Modératrice Java - Struts, Servlets/JSP, ...

  5. #5
    Expert éminent

    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
    Points : 7 778
    Points
    7 778
    Par défaut
    Et si tu remplaces ce code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <bean:define id="ids" property="lesChoix" value="lesChoix" /> 
    <html:select property="typeUtil">
       <html:options collection="ids" property="value" labelProperty="label" /> 
    </html:select>
    par celui-ci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <html:select property="typeUtil">
       <html:optionsCollection property="lesChoix"/> 
    </html:select>
    Modératrice Java - Struts, Servlets/JSP, ...

  6. #6
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 25
    Points : 18
    Points
    18
    Par défaut
    non c pas ca. j ai tjs la meme erreur

  7. #7
    Expert éminent

    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
    Points : 7 778
    Points
    7 778
    Par défaut
    Et comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <html:select name="nomDuFormBean" property="typeUtil">
       <html:optionsCollection property="lesChoix"/> 
    </html:select>
    Peux-tu montrer le mapping de l'Action de path /inscriptions et la déclaration du form-bean dans le struts-config.xml ?
    Modératrice Java - Struts, Servlets/JSP, ...

  8. #8
    Membre à l'essai
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    25
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 25
    Points : 18
    Points
    18
    Par défaut
    wé c ca
    c un pb de /inscription. je ai changer son nom ds le .xml et j l ai pas changer ds le .jsp
    merci bcp

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

Discussions similaires

  1. Réponses: 0
    Dernier message: 19/05/2012, 18h03
  2. No getter method available for property
    Par younestar dans le forum Struts 1
    Réponses: 5
    Dernier message: 01/09/2010, 18h41
  3. [error] No getter method available..
    Par CPI_en_mousse dans le forum Struts 1
    Réponses: 9
    Dernier message: 05/07/2007, 11h03
  4. Select dynamique
    Par mandaillou dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 24/11/2005, 15h14
  5. [selection de fenetre] Quelle methode utiliser?
    Par -=Spoon=- dans le forum Agents de placement/Fenêtres
    Réponses: 9
    Dernier message: 04/07/2005, 14h02

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