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

JSF Java Discussion :

Pb rafraîchissement d'une rich:dataTable


Sujet :

JSF Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4
    Par défaut Pb rafraîchissement d'une rich:dataTable
    Bonjour à tous,

    je débute avec l'ajax et les RichFaces et j'ai deux problèmes concernant une rich:dataTable dans une page jsf.

    Mon premier problème survient lorsque je fais un refresh de ma page jsf. En effet, les valeurs de mes colonnes sont doublées après ce refresh. Voici le code de ma page concernant ma rich:dataTable :

    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
     
     <ui:define name="body">
                <h:form>
                    <a4j:outputPanel id="all"> 
                        <c:choose>
                            <c:when test="${providerList.ok}">
                                <a4j:outputPanel id="provider">                                                   
                                    <div class="container">
                                        <div class="container_title">Providers Authorized : </div>
                                        <div class="container_text"> 
                                            <center>  
                                                <br/>   
                                                <a4j:outputPanel rendered="#{providerList.size2 != null}">
                                                    <a4j:outputPanel id="providerList">
                                                        <rich:dataTable width="70%" id="providerListTable" value="#{providerList.providers}" binding="#{providerList.dataTable}" var="provider" rows="2"> 
                                                            <f:facet name="header">
                                                                <rich:columnGroup>
                                                                    <h:column>
                                                                        <h:outputText styleClass="headerText" value="Usernname" />
                                                                    </h:column>
                                                                    <h:column>
                                                                        <h:outputText styleClass="headerText" value="Password" />
                                                                    </h:column>
                                                                    <h:column>		
                                                                        <h:outputText styleClass="headerText" value="Choice" />                                                                                                
                                                                    </h:column>
                                                                </rich:columnGroup>
                                                            </f:facet>
                                                            <rich:column>
                                                                #{provider.username}
                                                            </rich:column>
                                                            <rich:column>
                                                                #{provider.password}
                                                            </rich:column>
                                                            <rich:column>
                                                                <center>                                                          
                                                                    <!--<a4j:commandLink action="#{providerList.getProviderById}" reRender="selectedProvider">
                                                     <h:outputText value="Choose"/>
                                                     <a4j:actionparam name="selectedProviderRowIndex" value="#{providerList.dataTable.rowIndex}"/>
                                                 </a4j:commandLink>-->
                                                                    <h:selectBooleanCheckbox id="selected" binding="#{providerList.selected}"/>
                                                                </center>
                                                            </rich:column>
     
                                                        </rich:dataTable><br/><br/>
     
                                                        <center>
                                                            <rich:datascroller for="providerListTable" maxPages="100" />
                                                        </center>  
                                                        <br/><br/>
                                                    </a4j:outputPanel>                                   
                                                    <a4j:commandButton name="Edit" value="Edit" action="#{providerList.getProviderById}" reRender="all,context" styleClass="submit"> <!--reRender="all,providerList,selectedProvider,context"-->
                                                    </a4j:commandButton>                              
                                                </a4j:outputPanel>
     
                                                <a4j:outputPanel rendered="#{providerList.size2 == null}">                                            
                                                    <div class="warn_message"> there is no Provider </div>                         
                                                </a4j:outputPanel>
                                                <br/><br/>                                        
                                            </center>
                                        </div>
                                    </div>                                                                                                                                                                                           
                                </a4j:outputPanel>        
                                <a4j:outputPanel id="context"> 
                                    <div class="error_message">
                                        #{providerList.context}
                                    </div>
                                </a4j:outputPanel>
                            </c:when>
    Pour résumer après le refresh, dans mes 2 premières colonnes j'ai 2 fois les valeurs de #{provider.username} et #{provider.password} . La value de ma rich:dataTable est une liste présente dans mon managed-bean dont voici le bout de code correspondant :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
       private List<Provider> providers;
     
       ...
     
        public List<Provider> getProviders() {
            providers = new ArrayList<Provider>();
            providers = userManagementBean.findProviders("%%");
            return providers;
        }

    Mon deuxième pb survient aussi lors du refresh de la page. En effet, j'ai l'erreur qui me dit que le composant avec l'id providerListTable est déjà présent dans la page, alors qu'il n'est bien présent qu'une seule fois...
    Voici l'erreur :
    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
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
     
    java.lang.IllegalStateException: Component ID j_id18:providerListTable:j_id28 has already been found in the view.  See below for details.
    +id: _viewRoot
     type: org.ajax4jsf.framework.ajax.AjaxViewRoot@e5889f
      +id: j_id0
       type: <?xml version='1.0' encoding='UTF-8' ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
      +id: j_id1
       type: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://myfaces.apache.org/tomahawk">
      +id: j_id2
       type: 
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>
      +id: j_id3
       type: javax.faces.component.html.HtmlOutputText@6cb279
      +id: j_id4
       type: </title>
            <link href="./css/operator.css" rel="stylesheet" type="text/css"/>
        </head>
     
    <body>
     
        <div class="page">            
            <div class="header">
                <div class="top">
                    <div class="top_right">
                        <p><b>Operator Portal</b></p>
                    </div>
                </div>
                <div class="logo">
                    <img src="images/operator.png" width="60" height="60" alt="operatorlogo"/><h1><a href="#"><span class="dark">Plugs</span>NG</a></h1>
                </div>
            </div>
     
     
            <div class="bar">
      +id: j_id5
       type: javax.faces.component.html.HtmlForm@3932f9
        +id: j_id6
         type: 
                    <ul>
                        <li class="browse_category">Select Category:</li>
                        <li>
        +id: j_id7
         type: javax.faces.component.html.HtmlCommandLink@4191a7
        +id: j_id8
         type: </li>
                        <li class="active">Providers</li>
                        <li>
        +id: j_id9
         type: javax.faces.component.html.HtmlCommandLink@c19628
        +id: j_id10
         type: </li>
                        <li>
        +id: j_id11
         type: javax.faces.component.html.HtmlCommandLink@692ad7
        +id: j_id12
         type: </li>
                        <li>
        +id: j_id13
         type: javax.faces.component.html.HtmlCommandLink@7bbf51
        +id: j_id14
         type: </li>
                    </ul>
      +id: j_id15
       type: </div>
      +id: j_id16
       type:   
     
     
     
     
     
        <div class="content">
            <h3>
      +id: j_id17
       type: </h3>
            <div class="content_box">
      +id: j_id18
       type: javax.faces.component.html.HtmlForm@4d9c1f
        +id: all
         type: org.ajax4jsf.ajax.html.HtmlAjaxOutputPanel@44e714
          +id: j_id19
           type: 
     
                                    <div class="container">
                                        <div class="container_title">Providers Authorized : </div>
                                        <div class="container_text"> 
                                            <center>  
                                                <br/>
          +id: j_id20
           type: org.ajax4jsf.ajax.html.HtmlAjaxOutputPanel@9edb6a
            +id: providerList
             type: org.ajax4jsf.ajax.html.HtmlAjaxOutputPanel@574252
              +id: providerListTable
               type: org.richfaces.component.html.HtmlDataTable@c33471
                +id: j_id21
                 type: org.richfaces.component.html.HtmlColumnGroup@a7e928
                  +id: j_id22
                   type: javax.faces.component.UIColumn@bc577c
                    +id: j_id23
                     type: javax.faces.component.html.HtmlOutputText@139ca1
                  +id: j_id24
                   type: javax.faces.component.UIColumn@9016c9
                    +id: j_id25
                     type: javax.faces.component.html.HtmlOutputText@c7f5cc
                  +id: j_id26
                   type: javax.faces.component.UIColumn@da270b
                    +id: j_id27
                     type: javax.faces.component.html.HtmlOutputText@3948bd
                +id: j_id28
                 type: org.richfaces.component.html.HtmlColumn@d6adf4
                  +id: j_id29
                   type: 
                                                                #{provider.username}
                  +id: j_id42
                   type: 
                                                                #{provider.username}
                  +id: j_id28
                   type: 
                                                                #{provider.username}
                +id: j_id30
                 type: org.richfaces.component.html.HtmlColumn@36ac26
                  +id: j_id31
                   type: 
                                                                #{provider.password}
                  +id: j_id43
                   type: 
                                                                #{provider.password}
                  +id: j_id29
                   type: 
                                                                #{provider.password}
                +id: j_id32
                 type: org.richfaces.component.html.HtmlColumn@601f02
                  +id: j_id33
                   type: 
                                                                <center>
                  +id: j_id34
                   type: 
                                                                </center>
                  +id: j_id44
                   type: 
                                                                <center>
                  +id: j_id45
                   type: 
                                                                </center>
                  +id: j_id30
                   type: 
                                                                <center>
                  +id: selected
                   type: javax.faces.component.html.HtmlSelectBooleanCheckbox@93cc65
                  +id: j_id31
                   type: 
                                                                </center>
              +id: j_id21
               type: <br/><br/>
     
     
                                                        <br/><br/>
            +id: j_id22
             type: org.ajax4jsf.ajax.html.HtmlAjaxCommandButton@502be8
          +id: j_id23
           type: org.ajax4jsf.ajax.html.HtmlAjaxOutputPanel@72bdbe
            +id: j_id24
             type:                                             
                                                    <div class="warn_message"> there is no Provider </div>
          +id: j_id25
           type: 
                                                <br/><br/>                                        
                                            </center>
                                        </div>
                                    </div>
          +id: context
           type: org.ajax4jsf.ajax.html.HtmlAjaxOutputPanel@71d48
            +id: j_id26
             type:  
                                    <div class="error_message">
                                        #{providerList.context}
                                    </div>
      +id: j_id27
       type: 
            </div>
        </div>
        <div class="footer">
            <p><a href="#">Contact</a> | <a href="#">Disclaimer</a> | <a href="#">CSS</a> and <a href="#">XHTML</a><br/></p>
     
        </div>
     
        </div>
    </body>    
     
    </html>
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:337)
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:324)
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:324)
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:324)
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:324)
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:324)
            at com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:324)
            at com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:201)
            at org.ajax4jsf.framework.ajax.AjaxStateManager.saveSerializedView(AjaxStateManager.java:90)
            at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:594)
            at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
            at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
            at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
            at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
            at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
            at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:249)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
            at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
            at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
            at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:328)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
            at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
    En espérant avoir des réponses. Merci d'avance.

  2. #2
    Futur Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4
    Par défaut
    (Re) Bonjour,

    j'ai fait une avancée dans la résolution de mes pbs...Les deux pbs sont liées au binding de ma rich:dataTable....
    Lorsque j'enlève le binding="#{providerList.dataTable}", les 2 pbs disparaissent ms il m'est alors impossible de récupérer les lignes lors de l'appel à mon a4j:commandButton...

    Qqn aurai une solution ???? SVP.....

    Merci.

  3. #3
    Rédacteur
    Avatar de romaintaz
    Homme Profil pro
    Java craftsman
    Inscrit en
    Juillet 2005
    Messages
    3 790
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Java craftsman
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2005
    Messages : 3 790
    Par défaut
    Pour ne répondre qu'à ta dernière question, tu peux toujours faire ceci dans ton bean pour récupérer un composant JSF (comme la datatable par ex.) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    UIComponent component = FacesContext.getCurrentInstance().getViewRoot().findComponent("idComponent");
    Attention toutefois à l'id de ton composant dans le code ci dessus : il te faut mettre l'id complet, c'est-à-dire l'id de ta datatable préfixée par les IDs des NamingContainers qui la contienne. Autrement dit, si ta datatable se trouve dans un formulaire d'id myForm", alors l'id à donner sera "myForm:providerListTable".
    Nous sommes tous semblables, alors acceptons nos différences !
    --------------------------------------------------------------
    Liens : Blog | Page DVP | Twitter
    Articles : Hudson | Sonar | Outils de builds Java Maven 3 | Play! 1 | TeamCity| CitConf 2009
    Critiques : Apache Maven

  4. #4
    Futur Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4
    Par défaut
    Salut,

    merci de prendre le temps de me répondre , je vais essayer ta solution tout de suite.....

  5. #5
    Futur Membre du Club
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    4
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 4
    Par défaut
    Merci !!!!!!! Ta solution marche, je réussi bien à récupérer la ligne de ma dataTable et je n'ai plus mes pbs initiaux....Tu es un je n'aurai jamais pu la trouver celle là...Il faut suer quelques litres avant de pouvoir trouver une solution comme celle-ci...

    Merci bcp......

  6. #6
    Rédacteur
    Avatar de romaintaz
    Homme Profil pro
    Java craftsman
    Inscrit en
    Juillet 2005
    Messages
    3 790
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Java craftsman
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2005
    Messages : 3 790
    Par défaut
    Bah, c'est ce qu'on appelle l'expérience
    Après quelques mois d'utilisation, on commence à connaître 2-3 trucs sur JSF
    Nous sommes tous semblables, alors acceptons nos différences !
    --------------------------------------------------------------
    Liens : Blog | Page DVP | Twitter
    Articles : Hudson | Sonar | Outils de builds Java Maven 3 | Play! 1 | TeamCity| CitConf 2009
    Critiques : Apache Maven

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

Discussions similaires

  1. Réponses: 0
    Dernier message: 03/10/2013, 12h15
  2. Scroller sur les colonnes d'une rich:dataTable
    Par high4life dans le forum JSF
    Réponses: 2
    Dernier message: 06/07/2011, 11h25
  3. Réponses: 0
    Dernier message: 03/07/2009, 11h16
  4. Récupérer une ligne active rich:dataTable
    Par kookee dans le forum JSF
    Réponses: 3
    Dernier message: 26/03/2009, 15h12
  5. Réponses: 9
    Dernier message: 24/01/2008, 08h35

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