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 :

[nested]problème d'accès aux champs


Sujet :

Struts 1 Java

  1. #1
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut [nested]problème d'accès aux champs
    Salut;
    Dans mon application je doit gérer des événements qui sont organisés par une ou plusieurs personnes. Donc pour créer un nouvel événement, j'ai une classe NouvelEvenementForm qui contient un attribut de type Set (organisateurs) avec les bons setters et getters, et j'ai rajouté deux méthodes ajouterOrganisateur et retirerOrganisateur qui permettent de faire ce que leur noms respectifs indiquent .
    dans ma JSP j'ai un machin qui ressemble à ça
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <nested:iterate id="organisateur" name="NouvelEvenementForm" property="organisateurs">
       <layout:row>
       <layout:field key="identifiant" property="identifiant" name="organisateur" size="16" maxlength="16" isRequired="true" styleClass="LABEL" />
       <layout:field key="mot.de.passe" property="motDePasse" name="organisateur" size="16" maxlength="16" isRequired="true" type="password" styleClass="LABEL" />
       </layout:row>
    </nested:iterate>
    mais je n'arrive pas à récupérer les valeurs écrite dans les champs . (j'ai aussi essayé avec <nested:texte> et c'est pareil).
    pour vérifier l'accès à mes champs, j'ai surchargé la méthode toString qui donne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    @Override
    public String toString(){
       String s = new String();
       s+="\nle libellé de l'évenement est : '"+this.libelle+"'\net les organisateurs sont:";
       Iterator it = organisateurs.iterator();
       while(it.hasNext()){
          s+="\n"+((Personne)it.next()).getIdentifiant();
       }
    return s;
    }
    J'appelle cette méthode à la soumission de mon formulaire;
    Je rajoute quelques organisateurs histoire de tester, et je reçois ça en sortie
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    le libellé de l'évenement est : 'événement'
    et les organisateurs sont:
    null
    null
    null
    j'ai bien sûr une classe Personne avec un attribut identifiant et un attribut motDePasse
    On m'a en effet orienté ver la librairie de tags nested mais je ne comprend pas vraiment comment faire pour régler ce problème.
    Merci d'avance pour votre aide

  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
    Ton form-bean NouvelEvenementForm est dans quel scope : request ou session ?

    Et as-tu essayé tout simplement ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <nested:iterate name="NouvelEvenementForm" property="organisateurs">
     <tr>
       <td><nested:text property="identifiant"/></td>
       <td><nested:text property="motDePasse"/></td>
     </tr>
    </nested:iterate>
    Modératrice Java - Struts, Servlets/JSP, ...

  3. #3
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    Salut,
    Ton form-bean NouvelEvenementForm est dans quel scope : request ou session ?
    Dans mon struts-config, j'ai mis "scope=session", donc j'imagine que mon form-bean NouvelEvenementForm est dans le scope session,
    Et as-tu essayé tout simplement ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <nested:iterate name="NouvelEvenementForm" property="organisateurs"> 
       <tr> 
          <td><nested:text property="identifiant"/></td>
          <td><nested:text property="motDePasse"/></td>
       </tr>
    </nested:iterate>
    Et quand j'ai testé ton bout de code, Tomcat m'a sortie 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
    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
     
    ERROR [jsp]                           - "Servlet.service()" pour la servlet jsp a lancé une exception
    javax.servlet.jsp.JspException: Invalid argument looking up property: "organisateurs[0].identifiant" of bean: "NouvelEvenementForm"
    	at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:875)
    	at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:120)
    	at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:99)
    	at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:77)
    	at org.apache.struts.taglib.nested.html.NestedTextTag.doStartTag(NestedTextTag.java:60)
    	at org.apache.jsp.nouvelEvenement_jsp._jspx_meth_nested_text_0(nouvelEvenement_jsp.java:526)
    	at org.apache.jsp.nouvelEvenement_jsp._jspx_meth_nested_iterate_0(nouvelEvenement_jsp.java:493)
    	at org.apache.jsp.nouvelEvenement_jsp._jspService(nouvelEvenement_jsp.java:203)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    	at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
    	at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
    	at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
    	at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
    	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Unknown Source)
    WARN  AbstractExceptionHandler        - Unhandled exception
    org.apache.jasper.JasperException: Exception in JSP: /nouvelEvenement.jsp:36
     
    33: 		
    34: 			<nested:iterate name="NouvelEvenementForm" property="organisateurs">
    35:  <tr>
    36:    <td><nested:text property="identifiant"/></td>
    37:    <td><nested:text property="motDePasse"/></td>
    38:  </tr>
    39: </nested:iterate>
     
     
    Stacktrace:
    	at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    	at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
    	at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
    	at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
    	at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
    	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Unknown Source)
    WARN  ExceptionCatcher                - Exception from exceptionCommand 'servlet-exception'
    org.apache.jasper.JasperException: Exception in JSP: /nouvelEvenement.jsp:36
     
    33: 		
    34: 			<nested:iterate name="NouvelEvenementForm" property="organisateurs">
    35:  <tr>
    36:    <td><nested:text property="identifiant"/></td>
    37:    <td><nested:text property="motDePasse"/></td>
    38:  </tr>
    39: </nested:iterate>
     
     
    Stacktrace:
    	at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    	at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
    	at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
    	at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
    	at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
    	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Unknown Source)
    ERROR [action]                        - "Servlet.service()" pour la servlet action a généré une exception
    javax.servlet.jsp.JspException: Invalid argument looking up property: "organisateurs[0].identifiant" of bean: "NouvelEvenementForm"
    	at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:875)
    	at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:120)
    	at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:99)
    	at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:77)
    	at org.apache.struts.taglib.nested.html.NestedTextTag.doStartTag(NestedTextTag.java:60)
    	at org.apache.jsp.nouvelEvenement_jsp._jspx_meth_nested_text_0(nouvelEvenement_jsp.java:526)
    	at org.apache.jsp.nouvelEvenement_jsp._jspx_meth_nested_iterate_0(nouvelEvenement_jsp.java:493)
    	at org.apache.jsp.nouvelEvenement_jsp._jspService(nouvelEvenement_jsp.java:203)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    	at org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
    	at org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
    	at org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
    	at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
    	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    	at java.lang.Thread.run(Unknown Source)
    Bon, j'ai mis toute la trace au cas où ... je n'ai pas compris grand chose à cette erreur personnellement .
    mais si t'as d'autres idées, ou une éventuelle correction, n'hésites pas

  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
    Peux-tu montrer comment tu as déclaré le Set organisateurs dans l'ActionForm et comment tu l'initialises ?
    Modératrice Java - Struts, Servlets/JSP, ...

  5. #5
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    pour la déclaration, rien de plus simple (dans mon ValidatorForm) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    private Set<Personne> organisateurs = new hashSet<Personne>();
    avec des setters et des getter classics;
    pour l'initialisation, je le déclare comme variable de session (je ne voie pas comment faire autrement )
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    Set<Personne> organisateurs = new HashSet<Personne>();
    organisateurs.add(new Personne());
    request.getSession().setAttribute("organisateurs", organisateurs);
    Et je fait ça dans une Action avant d'accéder à ma page.

  6. #6
    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
    Pour l'initialisation du form dans l'Action, essaie ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Set<Personne> organisateurs = new HashSet<Personne>();
    organisateurs.add(new Personne());
    TonActionForm tonActionForm = (TonActionForm) form ;
    tonActionForm.setOrganisateurs(organisateurs) ;
    Pour que cela fonctionne, il faut ajouter name="nomDeTonFormBean" dans le mapping de cette Action dans le struts-config.xml et mettre validate à false.

    Et comment initialises-tu les propriétés identifiant et motDePasse dans le constructeur de la classe Personne ?
    Modératrice Java - Struts, Servlets/JSP, ...

  7. #7
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    Alors,
    j'ai testé le code que tu m'as proposé, mais ça donne la même chose :'(.
    pour ce qui est de l'initialisation des attributs identifiant et motDePasse, je ne la gère pas du tout dans mon constructeur, j'ai fait des getters et des setter, ce qui était suffisant pour leur initialisation avec Hibernate, quand je lie à partire de la base de donnée les informations sur les personnes. j'espérait que struts se débrouillerait tout seul comment un grand en les initialisant à paritire des champs remplis dans le formulaire à l'aide des stters

    au fait, si je met validate à false, la validation du formulaire n'est plus réalisée, même en rajoutant dans mon action (pour la soumission du formulaire) le code suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ((NouvelEvenementForm)form).validate(mapping , request);
    au cas où cela soit nécessaire, comment pallier à ce problème ?

  8. #8
    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
    Je pensais que ton Action d'initialisation était une Action simple.
    Dans ce cas, le validate à false était justifié.

    Comme tu initialises ton formulaire via une méthode d'une LookupDispatchAction, à toi de voir si tu peux le laisser à true.
    Tout dépend ce que tu gères comme erreurs de validation.

    Si toutefois tu dois mettre validate à false et faire la validation dans une méthode de LookupDispatchAction, tu peux faire comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    		ActionMessages errors = form.validate(mapping,request);
    		if ( !errors.isEmpty() )
    		{
    			saveErrors(request,errors);
    			return mapping.getInputForward() ;
    		}
    Petite question : ta liste d'organisateurs est sensée être vide au premier affichage du formulaire ou pas ?
    Modératrice Java - Struts, Servlets/JSP, ...

  9. #9
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    Normalement oui, elle est vide au démarage, le problème, c'est que lorsque je la remplie et que je soummet (je rappelle qu'à la soumission, je redirige vers la même page avec un petit affichage) tous les champs garde les valeurs remplies au préalable sauf les champs des identifiants et mots de passes,
    le liens avec les éléments de la liste ne sarait-il pas fait ?
    si c'est ça, comment faire le lien ?

  10. #10
    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
    Normalement, si tu codes le nested:iterate comme je te l'ai indiqué plus haut, dès que tu renseignes un identifiant et un motDePasse et que tu soumets le formulaire, le Set doit être mis à jour automatiquement.

    Dans le code suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    public void ajouterOrganisateur(){
    	organisateurs.add(new Personne ());
    	System.out.println("nombre d'organisateurs pour le moement : "+organisateurs.size());
    }
    peux-tu faire un test en mettant organisateurs.add(new Personne()) en commentaire ?
    parce qu'en fait, avec cette instruction, je pense que tu ajoutes dans ton Set un bean Personne avec un identifiant et un motDePasse à null.
    Modératrice Java - Struts, Servlets/JSP, ...

  11. #11
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    Le code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <nested:iterate name="NouvelEvenementForm" property="organisateurs">
     <tr>
       <td><nested:text property="identifiant"/></td>
       <td><nested:text property="motDePasse"/></td>
     </tr>
    </nested:iterate>
    me sort la même erreur que plus haut :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    Invalid argument looking up property: "organisateurs[0].identifiant" of bean: "NouvelEvenementForm"
    ....
    en fait, j'ai essayé d'initialiser l'identifiant et le mot de passe des personnes dans l'action "initialiserNouvelEvenement" :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
        Set<Personne> organisateurs = new HashSet<Personne>();
        Personne personne = new Personne ();
        personne.setIdentifiant(new String("utilisateur"));
        personne.setMotDePasse(new String("motdepassedetest"));
        organisateurs.add(personne);
        NouvelEvenementForm nouvelEvenementForm = (NouvelEvenementForm)form;
        nouvelEvenementForm.setOrganisateurs(organisateurs);
    et avec le code suivant, j'obtiens bien les champs avec les bonne valeurs :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <nested:iterate id="organisateur" name="nouvelEvenementForm" property="organisateurs">
    <layout:row>
        <layout:field key="identifiant" property="identifiant" name="organisateur" size="16" maxlength="16" isRequired="true" styleClass="LABEL" />
        <layout:field key="mot.de.passe" property="motDePasse" name="organisateur" size="16" maxlength="16" isRequired="true" type="password" styleClass="LABEL" />
    </layout:row>
    </nested:iterate>
    mais malgrès le fait que je les modifie, quand je soumet mon formulaire, les valeurs des champs redevienne comme avant (les valeur de l'initialisation, et à l'affichage (System.out.print(...) j'ai la même chose
    je ne veux pas trop m'avancer, mais j'ai l'impression qu'il ne fait pas de lecture , il n'utilise pas mon setter :'(:'(.pourtant, les getter il les utilise bien, l'affichage est parfait à l'initialisation !!!

  12. #12
    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
    Je ne comprends pas pourquoi tu as ce message d'erreur :
    Invalid argument looking up property: "organisateurs[0].identifiant" of bean: "NouvelEvenementForm"
    Mais j'avoue que je n'ai jamais utilisé les tags nested:iterate et nested:text avec un Set.
    Pourrais-tu tester avec une ArrayList ?
    A moins qu'utiliser un Set soit une obligation pour toi ?

    Au fait, quelle version de Struts utilises-tu ?
    Modératrice Java - Struts, Servlets/JSP, ...

  13. #13
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    par où commencer ???
    pour moi l'utilisation des Set n'est pas obligatoire, c'est juste un habitude que j'ai prise en squattant les tutos de Hibernate
    donc j'ai testé avec ArrayList et ton code marche parfaitement ...
    mais il y a un ic ...
    le truc, c'est que je voudrais utiliser les tags layout pour respecter un skin ... mais quand je met mes balises <layout:texte.../> comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <nested:iterate name="nouvelEvenementForm" property="organisateurs">
        <layout:field key="identifiant" property="identifiant" size="16" isRequired="true" styleClass="LABEL" />
        <layout:field key="mot.de.passe" property="motDePasse" size="16" isRequired="true" type="password" styleClass="LABEL" />
    </nested:iterate>
    j'ai (comme on aurait pu le prévoire) l'erreure suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    No getter method for property: "identifiant" of bean: "com.mariages.struts.form.NouvelEvenementForm"
    ...
    croyez vous que je doit fermer cette ligne de discussion (Résolue) pour reposer ma question ailleurs (une nouvelle ) ou puis-espérer pouvoir continuer sur la même et avoir une réponse à mon problème ???

    PS : j'ai mis la valeur de "nested.compatibility" à true dans le fichier de conf de struts-layout au cas où ce soit à cause de ça, mais ça n'a pas résolu mon problème

  14. #14
    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
    4
    5
    6
    7
    8
    <layout:collection name="nouvelEvenementForm" property="organisateurs" offsetIndexId="index" >
    	<layout:collectionItem title="identifiant">
    		<layout:text property="organisateurs[${index}].identifiant" layout="false" styleClass="LABEL"/>
    	</layout:collectionItem>
    	<layout:collectionItem title="mot.de.passe">
    		<layout:text property="organisateurs[${index}].motDePasse" layout="false" styleClass="LABEL"/>
    	</layout:collectionItem>
    </layout:collection>
    Modératrice Java - Struts, Servlets/JSP, ...

  15. #15
    Membre habitué Avatar de anayathefirst
    Profil pro
    Inscrit en
    Décembre 2006
    Messages
    326
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Décembre 2006
    Messages : 326
    Points : 182
    Points
    182
    Par défaut
    ça, j'aurais pas trouvé tout seul
    merci beaucoup, c'est NIKEL

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

Discussions similaires

  1. Réponses: 16
    Dernier message: 07/02/2006, 14h19
  2. accés aux champs dynamiques ?
    Par bassim dans le forum Bases de données
    Réponses: 3
    Dernier message: 07/11/2005, 20h58
  3. [Applet] problèmes d'accès aux images
    Par wwave dans le forum Interfaces Graphiques en Java
    Réponses: 18
    Dernier message: 16/09/2005, 14h42
  4. Focus fenêtre + accès aux champs
    Par Pymm dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 28/07/2005, 12h07
  5. [TOMCAT] JSP problème d'accès aux méthodes d'une classes
    Par gunnm dans le forum Tomcat et TomEE
    Réponses: 3
    Dernier message: 22/05/2004, 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