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.