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 :

[error] No getter method available..


Sujet :

Struts 1 Java

  1. #1
    Membre habitué
    Avatar de CPI_en_mousse
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 332
    Points : 168
    Points
    168
    Par défaut [error] No getter method available..
    Bonjour,

    J'obtiens l'erreur 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
    javax.servlet.jsp.JspException: No getter method available for property 1 for bean under name null
        org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382)
        org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:243)
        org.apache.jsp.applicant.commentApplicant_jsp._jspx_meth_html_options_0(commentApplicant_jsp.java:581)
        org.apache.jsp.applicant.commentApplicant_jsp._jspx_meth_html_select_0(commentApplicant_jsp.java:533)
        org.apache.jsp.applicant.commentApplicant_jsp._jspx_meth_html_form_0(commentApplicant_jsp.java:433)
        org.apache.jsp.applicant.commentApplicant_jsp._jspService(commentApplicant_jsp.java:184)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    lors de l'affichage de la page 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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    <%@ 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://displaytag.sf.net" prefix="display"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    Author : Florian Guillemotte
    Email : fguillemotte@gmail.com
    --%>
     
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <logic:notPresent scope="session" name="user">
        <logic:forward name="logon"/>
    </logic:notPresent>
    <logic:notPresent scope="session" name="applicant">
        <logic:forward name="search"/>
    </logic:notPresent>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title><bean:message key="application.title"/></title>
            <style type="text/css" media="all">
                @import url("./css/site.css");
            </style>    
            <script type="text/javascript">
                <!--
    window.onload=show;
    function show(id) {
    var d = document.getElementById(id);
        for (var i = 1; i<=10; i++) {
            if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
        }
    if (d) {d.style.display='block';}
    }
    //-->        
            </script>
        </head>
        <body>       
            <div id="titre">
                <bean:message key="application.title"/>
            </div>
            <div id="soustitre">
                <bean:write scope="session" name="user" property="login"/>
            </div>
            <div id="topRow">
                <div id="menu">                
                    <dl>
                        <dt onmouseover="javascript:show();"><a href="/QATS/main.jsp" title="Go to Home page">Home</a></dt>
                    </dl>                
                    <dl>            
                        <dt onmouseover="javascript:show('smenu1');">TODO List</dt>
                        <dd id="smenu1">
                            <ul>
                                <li><a href="/QATS/todoList.jsp" title="See Todo list of all users">All Todo</a></li>                            
                                <li><a href="/QATS/applicant/applicant.jsp" title="Create a new applicant file">New Applicant</a></li>
                                <li><a href="/QATS/applicant/searchApplicant.jsp" title="Search an applicant">Search</a></li>
                                <li><a href="#" title="All applicant which are in reserve">In reserve</a></li>
                            </ul>
     
                        </dd>
                    </dl>                       
                    <dl>    
                        <dt onmouseover="javascript:show('smenu2');">Applicant</dt>
                        <dd id="smenu2">
                            <ul>
                                <li><a href="/QATS/applicant/DisplayApplicant.jsp" title="Display information about the current applicant">Details</a></li>
                                <li><a href="/QATS/applicant/history.jsp" title="Display the historic about the current applicant">Historic</a></li>                            
                                <li><a href="/QATS/applicant/commentApplicant.jsp" title="Display all comments about the current applicant">Comment</a></li>
                                <li><a href="#" title="List all documents which concern the current applicant">Document</a></li>
                                <li><a href="#" title="Display additional information about the current applicant">Interview</a></li>
                            </ul>
                        </dd>
                    </dl>
                    <dl>    
                        <dt onmouseover="javascript:show('smenu3');">Tools</dt>
                        <dd id="smenu3">                                
                            <ul>
                                <li><a href="#">Statistics</a></li>
                                <li><a href="/QATS/about.jsp">About</a></li>
                                <li><a href="/QATS/releaseNotes.jsp">Release Notes</a></li>
                            </ul>
                        </dd>
                    </dl>               
                    <dl>
                        <dt onmouseover="javascript:show();"><html:link action="/logout" linkName="Log me out">Logout</html:link></dt>
                    </dl>                 
                </div>
            </div>
     
            <div id="bodyRow">
                <fieldset>
                    <legend>comments</legend>
                    <html:form action="addComment" styleId="addComment">
                        <table>
                            <tr>
                                <td><bean:message key="message.comment"/></td>
                                <td><html:textarea property="comment" title="enter your comment here" tabindex="10"/></td>
                            </tr>
                            <tr>
                                <td><bean:message key="message.interest"/></td>
                                <td>
                                    <html:select property="interest" tabindex="30">                                    
                                        <html:options property="1" labelName="++" labelProperty="++"/>
                                        <html:options property="2" labelName="+" labelProperty="+"/>
                                        <html:options property="3" labelName="=" labelProperty="="/>
                                        <html:options property="4" labelName="-" labelProperty="-"/>
                                        <html:options property="5" labelName="--" labelProperty="--"/>
                                    </html:select>
                                </td>
                            </tr>
                        </table>
                        <html:submit tabindex="150"><bean:message key="button.submit" /></html:submit>
                    </html:form>
                </fieldset>
            </div>
            <div id="footer">
                <bean:message key="application.footer" /><br><bean:message key="application.version" />
            </div> 
        </body>
    </html>
    le l'actionForm du formulaire contient bien les getter et setter.
    Je ne sais pas d'ou cela peu provenir,

    Merci pour votre aide

  2. #2
    Membre à l'essai
    Inscrit en
    Janvier 2007
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 33
    Points : 24
    Points
    24
    Par défaut
    Y a quoi dans ton fichier struts-config.xml?
    As tu déclarer le bean?
    Le problème vient de ta liste déroulante enfin je crois?
    Vérifie les noms que tu utilise dans ton bean et dans ton fichier jsp je pense que le problème vient de la.
    De plus n'y a t-il pas un attribut name a spécifier dans ton tag pour dire le nom du bean? Regarde la doc ...

  3. #3
    Membre habitué
    Avatar de CPI_en_mousse
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 332
    Points : 168
    Points
    168
    Par défaut
    oui bien sur, voici l'extrait de struts config.xml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <action input="/applicant/commentApplicant.jsp" 
                    name="AddCommentForm" 
                    path="/addComment" 
                    scope="session" 
                    type="be.qspin.qats.struts.action.AddCommentAction">
                <forward name="sucess" path="/applicant/commentApplicant.jsp"/>            
            </action>

  4. #4
    Membre chevronné Avatar de Mister Nono
    Homme Profil pro
    Ingénieur Mathématiques et Informatique
    Inscrit en
    Septembre 2002
    Messages
    2 232
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur Mathématiques et Informatique
    Secteur : Santé

    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 232
    Points : 1 897
    Points
    1 897
    Par défaut
    Ton objet User a-t-il été initialisé et se trouve-t-il en session ?

    A+

  5. #5
    Membre habitué
    Avatar de CPI_en_mousse
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 332
    Points : 168
    Points
    168
    Par défaut
    Citation Envoyé par Mister Nono
    Ton objet User a-t-il été initialisé et se trouve-t-il en session ?
    A+
    oui bien sur, de meme que l'objet applicant

  6. #6
    Membre chevronné Avatar de Mister Nono
    Homme Profil pro
    Ingénieur Mathématiques et Informatique
    Inscrit en
    Septembre 2002
    Messages
    2 232
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur Mathématiques et Informatique
    Secteur : Santé

    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 232
    Points : 1 897
    Points
    1 897
    Par défaut
    Les accesseurs pour chaque attribut existent-ils et ceux-ci sont-ils initialisés (donc différent de null) ?

  7. #7
    Membre habitué
    Avatar de CPI_en_mousse
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 332
    Points : 168
    Points
    168
    Par défaut
    mon 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
    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
    /*
     * AddCommentForm.java
     *
     * Created on 22 mai 2007, 13:38
     */
     
    package be.qspin.qats.struts.form;
     
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
     
    /**
     *
     * @author Florian Guillemotte
     * @author fguillemotte@gmail.com
     * @version
     */
     
    public class AddCommentForm extends org.apache.struts.action.ActionForm {
     
        /**
         *
         */
        public AddCommentForm() {
            super();
            // TODO Auto-generated constructor stub
        }
     
        public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
            ActionErrors errors = new ActionErrors();
            if (getComment() == null || getComment().length() < 1) {
                errors.add("comment", new ActionMessage("error.comment.null"));
                // TODO: add 'error.name.required' key to your resources
            }
            return errors;
        }
     
        /**
         * Holds value of property comment.
         */
        private String comment;
     
        /**
         * Getter for property comment.
         * @return Value of property comment.
         */
        public String getComment() {
            return this.comment;
        }
     
        /**
         * Setter for property comment.
         * @param comment New value of property comment.
         */
        public void setComment(String comment) {
            this.comment = comment;
        }
     
        /**
         * Holds value of property interest.
         */
        private String interest;
     
        /**
         * Getter for property interest.
         * @return Value of property interest.
         */
        public String getInterest() {
            return this.interest;
        }
     
        /**
         * Setter for property interest.
         * @param interest New value of property interest.
         */
        public void setInterest(String interest) {
            this.interest = interest;
        }
    }

  8. #8
    Membre éprouvé
    Profil pro
    Développeur Back-End
    Inscrit en
    Avril 2003
    Messages
    782
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Back-End

    Informations forums :
    Inscription : Avril 2003
    Messages : 782
    Points : 935
    Points
    935
    Par défaut
    Bonjour,

    l'erreur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    No getter method available for property 1 for bean under name null
    vient selon moi de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <html:options property="1" labelName="++" labelProperty="++"/>
    Comment souhaite tu alimenter la combobox ?

  9. #9
    Membre habitué
    Avatar de CPI_en_mousse
    Homme Profil pro
    Développeur Java
    Inscrit en
    Avril 2006
    Messages
    332
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2006
    Messages : 332
    Points : 168
    Points
    168
    Par défaut
    Citation Envoyé par fnobb
    Bonjour,
    Comment souhaite tu alimenter la combobox ?
    c'est à dire? si elle est dynamique ou fixe? elle est fixe

    l'erreur Code :
    No getter method available for property 1 for bean under name null


    vient selon moi de Code :
    <html:options property="1" labelName="++" labelProperty="++"/>
    oui tu avais raison, les "s" de html:option sont en trop

    et dire que je ne l'ai pas vu, ca m'apprendra a faire des copier coller

    En tous cas merci bien

  10. #10
    Membre actif
    Profil pro
    Developpeur
    Inscrit en
    Avril 2004
    Messages
    160
    Détails du profil
    Informations personnelles :
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Developpeur

    Informations forums :
    Inscription : Avril 2004
    Messages : 160
    Points : 212
    Points
    212
    Par défaut
    L'erreur est bien dis dans le message d'erreur :
    javax.servlet.jsp.JspException: No getter method available for property 1 for bean null

    Dans ta page, pour remplir ta liste déroulante:

    <html:select property="interest" tabindex="30">
    <html:options property="1" labelName="++" labelProperty="++"/>
    <html:options property="2" labelName="+" labelProperty="+"/>
    <html:options property="3" labelName="=" labelProperty="="/>
    <html:options property="4" labelName="-" labelProperty="-"/>
    <html:options property="5" labelName="--" labelProperty="--"/>
    </html:select>

    c'est normal que ça marche pas, il cherche une propriete (propriete d'un bean) nomé 1, en plus dasn le message aucin bean est rensiegné.

    SI tu veux mettre des valeurs en dur ( 1,3,.....) utilise surtout
    <html:option value="1"/>
    <html:option value="2"/>
    .....

+ 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. logic:iterate + ArrayList -> no getter method
    Par TelcharF dans le forum Struts 1
    Réponses: 4
    Dernier message: 04/07/2007, 15h05
  4. select dynamique : No getter method available
    Par salsoul dans le forum Struts 1
    Réponses: 7
    Dernier message: 09/05/2007, 23h31
  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