salut
j'ai la page jsf suivante dont il y a un datatable avec id="books" et je le met à jour à chaque action d'un autre button
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:f="http://java.sun.com/jsf/core"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">  
 
    <h:head>
        <meta http-equiv="Refresh" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Stock Restant</title>
        <link rel="stylesheet" type="text/css" href="styles.css" />
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
        <link href="./resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
        <script type='text/javascript' src='./resources/css/jquery-1.2.3.min.js'></script>
        <script type='text/javascript' src='./resources/css/menu.js'></script>
        <link rel="stylesheet" href="./resources/css/style.css" type="text/css" media="screen" />
        <p:resources />
        <script language="javascript">
            function ConfirmDelete(link)
            { var del = confirm('Do you want to Delete?');
                if (del == true) { link.onclick(); }
            }
        </script>
    </h:head>
    <h:body>
 
 
 
 
        <ui:include src="haut.xhtml" />
        <f:view>
            <h:form> 
                <p:dataTable value="#{affectation.stocks}" id="tbl" 
                             var="puce" height="50"  rows="10"
                             selection="#{affectation.selectedStocks}" paginator="true"
                             >
                    <f:facet name="header">
                        Stock Restant
                    </f:facet>
                    <p:column style="width:18px" >
                        <p:selectBooleanCheckbox value="#{affectation.value2}">  
                            <p:ajax listener="#{affectation.addMessage(puce)}"/>  
                        </p:selectBooleanCheckbox>   
                    </p:column>
                    <p:column headerText="id" style="width:100px" filterBy="#{puce.id}"
 
                              filterMatchMode="contains" >
                        <f:facet name="header">
                            <h:outputText value="Id" />
                        </f:facet>
 
                        <h:outputText value="#{puce.id}"/>
                    </p:column>
                    <p:column headerText="code à barre" style="width:100px" filterBy="#{puce.codebarre}"
 
                              filterMatchMode="contains" >
                        <f:facet name="header">
                            <h:outputText value="code à barre" />
                        </f:facet>
                        <h:outputText value="#{puce.codebarre}"/>
                    </p:column>
 
                    <p:column headerText="num GSM" style="width:100px" filterBy="#{puce.ngsm}"
 
                              filterMatchMode="contains" >
                        <f:facet name="header">
                            <h:outputText value="num GSM" />
                        </f:facet>
                        <h:outputText value="#{puce.ngsm}"/>
                    </p:column>
 
 
 
 
 
 
 
                    <p:column style="width:40px">  
                        <p:commandButton value="Add"   
                                         action="#{affectation.createNew(puce)}" update="books" />  
                        <p:ajaxStatus style="width:16px;height:16px;">  
                            <f:facet name="start">  
                                <h:graphicImage value="/images/ajaxloading.gif" />  
                            </f:facet>  
 
                            <f:facet name="complete">  
                                <h:outputText value="" />  
                            </f:facet>  
                        </p:ajaxStatus>   
                    </p:column>  
                </p:dataTable>
                <h:panelGrid width="25%">
                    <p:dataTable id="books" value="#{affectation.selectedStocks}" var="car">  
 
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Caractéristiques" />  
                            </f:facet>  
                            <h:outputText value="#{car.ngsm}" />  
                        </p:column>  
 
 
 
                    </p:dataTable>  
                </h:panelGrid>
                <p:panel header="Export All Data">  
                    <h:commandButton value="affecter"  action ="#{affectation.afect()}"/>
                    <h:commandLink>  
                        <p:graphicImage value="/images/excel.png" />  
                        <p:dataExporter type="xls" target="tbl" fileName="cars" />  
                    </h:commandLink>  
 
                    <h:commandLink>  
                        <p:graphicImage value="/images/pdf.png" />  
                        <p:dataExporter type="pdf" target="tbl" fileName="cars"/>  
                    </h:commandLink>  
 
                    <h:commandLink>  
                        <p:graphicImage value="/images/csv.png" />  
                        <p:dataExporter type="csv" target="tbl" fileName="cars" />  
                    </h:commandLink>  
 
                    <h:commandLink>  
                        <p:graphicImage value="/images/xml.png" />  
                        <p:dataExporter type="xml" target="tbl" fileName="cars" />  
                    </h:commandLink>  
                </p:panel>
            </h:form>
        </f:view>
        <ui:include src="bas.xhtml" />
 
 
    </h:body>
</html>
il m'affiche l'erreur suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
GRAVE: Error Rendering View[/AffectationParPlage2.xhtml]
javax.faces.FacesException: Cannot find component with identifier "books" in view.
d'après ce que j'ai compris , il n'a pas trouvez le composant avec id=books alors qu'il existe!!!!!!!!