Bonjour ,
je suis en train de developper un site web en jsf et je dois afficher une liste de commande appartenant a un user dans un dataTable
Pour resumer mon code:
Dans ma page jsf j'appelle un <jsp:useBean> qui instancie ma classe logView
Dans cette classe j'ai un champ User et dans cette classe User j'ai un Vector<Command> Com
Dans l'attribut value da ma dataTable je met:
value="#{log.user.Com}"
et tomcat me sort une exception disant que ma property n'est pas trouve
si quelqu'un a une idée parce que la je comprend pas pourquoi il ne me trouve pas mon champ Com
ci apres tous les details
Voila ma page jsf
voila la classe logView qui correspond a mon log dans la page jsf precedente
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 %@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page import="pBean.viewLog"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <jsp:useBean class="pBean.viewLog" scope="session" id="log" > <jsp:setProperty name="log" property="page" value="loginForm.jsp" /> </jsp:useBean> <core:view> <html> <head> <title>DJStore</title> <link rel="shortcut icon" href="favicon.ico" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> <meta http-equiv="content-language" content="fr" /> <link href="includes/css/style.css" title="Défaut" rel="stylesheet" type="text/css" media="screen" /> <script type="text/javascript" src="code-js.js"></script> </head> <body> <div id="header"> <h1>DJStore</h1> <h2>Choisissez, Ecoutez, Mixez</h2> <jsp:include page="<%= log.getPage()%>"/> <ul id="menu"> <html:form> <li> <html:commandLink id="liensAccueil" action="accueil"><html:outputText value="Accueil - " /></html:commandLink></li> <%if (log.getUser() != null){ %> <li> <html:commandLink id="liensMonProfil" action="monProfil"><html:outputText value="Mon Profil - " /></html:commandLink></li> <%} %> <li> <html:commandLink id="liensProduits" action="Produits"><html:outputText value="Matériel" /></html:commandLink></li> <%if (log.getUser() != null && (log.getUser().getRights() == 1 || log.getUser().getRights() == 3)) { %> <li> <html:commandLink id="addProduit" action="addProduits"><html:outputText value="ajouterUnPrduit" /></html:commandLink></li> <%} %> </html:form> </ul> </div> <div id="contenu"> <% if (log.getUser() == null) { %> <html:outputText value="Attention vous devez etre connecté pour pouvoir accéder à cette page" /> <%} else { %> <html:dataTable value="#{log.user.Com}" var="Commandes"> <html:column> <html:outputText value="#{Commandes.idCommand}" /> </html:column> <html:column> <html:outputText value="#{Commandes.payment}" /> </html:column> <html:column> <html:outputText value="#{Commandes.status}" /> </html:column> <html:column> <html:outputText value="#{Commandes.date.toString}" /> </html:column> <html:column> <html:outputText value="#{Commandes.SommeTot}" /> </html:column> </html:dataTable> <%} %> </div> </body> </html> </core:view>
et enfin voila ma class User
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 package pBean; import pModel.User; public class viewLog { private String login; private String pass; private String page; private User user; public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPass() { return pass; } public void setPass(String pass) { this.pass = pass; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public String connection() { connection c = new connection(); c.setLogin(login); c.setPassword(pass); user = c.connect(); System.out.println(user.getName()); if (user != null) page = ""; else page = "loginForm.jsp"; return (page); } public void setUser(User user) { this.user = user; } public User getUser() { return user; } }
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 import java.util.Vector; public class User { private int id; private String name; private String firstname; private String mail; private int age; private String Addr; private String Mdp; private String login; private int sum; private int rights; private String adresseLivraison; private Vector<Command> Com; public User() { id = 0; name = null; firstname = null; mail = null; age = 0; Addr = null; Mdp = null; login = null; sum = 0; rights = -1; adresseLivraison = null; Com = null; } public User(String _name, String firstName, String Mail, int Age, String addr, String mdp, String Login, int Sum, String addrL) { id = 0; name = _name; firstname = firstName; mail = Mail; age = Age; Addr = addr; Mdp = mdp; login = Login; sum = Sum; rights = -1; adresseLivraison = addrL; Com = null; } public void addSum(int nb) { sum += nb; } public boolean isName() { if (name != null) return (true); return (false); } public boolean isFirstname() { if (firstname != null) return (true); return (false); } public boolean isMail() { if (mail != null) return (true); return (false); } public boolean isAge() { if (age > 0) return (true); return (false); } public boolean isAddr() { if (Addr != null) return (true); return (false); } public boolean isLogin() { if (login != null) return (true); return (false); } public boolean isMdp() { if (Mdp != null) return (true); return (false); } public boolean isAdresseLivraison() { if (adresseLivraison != null) return (true); return (false); } public boolean isSum() { if (sum > 0) return (true); return (false); } public boolean isRight() { if (rights > -1) return (true); return (false); } public void setId(int id) { this.id = id; } public int getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getFirstname() { return firstname; } public void setMail(String mail) { this.mail = mail; } public String getMail() { return mail; } public void setAge(int age) { this.age = age; } public int getAge() { return age; } public void setAddr(String addr) { Addr = addr; } public String getAddr() { return Addr; } public void setMdp(String mdp) { Mdp = mdp; } public String getMdp() { return Mdp; } public void setLogin(String login) { this.login = login; } public String getLogin() { return login; } public void setSum(int sum) { this.sum = sum; } public int getSum() { return sum; } public void setRights(int rights) { this.rights = rights; } public int getRights() { return rights; } public void setCom(Vector<Command> com) { Com = com; } public Vector<Command> getCom() { return Com; } public void setAdresseLivraison(String adresseLivraison) { this.adresseLivraison = adresseLivraison; } public String getAdresseLivraison() { return adresseLivraison; } }
enfin l'erreur est :
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 javax.servlet.ServletException: javax.faces.el.PropertyNotFoundException: Bean: pModel.User, property: Com javax.faces.webapp.FacesServlet.service(FacesServlet.java:154) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144) cause mère javax.faces.FacesException: javax.faces.el.PropertyNotFoundException: Bean: pModel.User, property: Com org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425) org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211) org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41) org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132) javax.faces.webapp.FacesServlet.service(FacesServlet.java:140) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
bonne journee
Partager