Bonjour,
Je suis débutante en JSF et j'ai depuis hier le meme msg d'erreur qui s'affiche pourtant jai bien suivi la tuto du lien
ftp://ftp-developpez.com/schmitt/tut...troduction.pdf
j'arrive pas à avancer je suis vraiment bloquée, j'espere que quelqu'un m'aide à comprendre cette erreur afin ke je puisse la corriger
fichier web.xml
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 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>jsf2</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> </web-app>
fichier faces-config.xml
data-table.jsp
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 <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> <managed-bean> <managed-bean-name>accountDatas</managed-bean-name> <managed-bean-class>com.facestut.bean.AccountDatas</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>Bank</managed-bean-name> <managed-bean-class>com.facestut.bean.Bank</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>customer</managed-bean-name> <managed-bean-class>com.facestut.bean.Customer</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <navigation-rule> <!-- Indique pour quelle vue courante la règle s'applique --> <from-view-id>/index.jsp</from-view-id> <navigation-case> <!-- Si l'outcome renvoyé est HelloWorldAction alors JSF passe à la page /hello-world.jsp --> <from-outcome>HelloWorld</from-outcome> <to-view-id>/account-form.jsp</to-view-id> </navigation-case> </navigation-rule> <navigation-rule> <from-view-id>/account-form.jsp</from-view-id> <navigation-case> <from-outcome>AccountDatasOK</from-outcome> <to-view-id>/success.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>AccountDatasError</from-outcome> <to-view-id>/error.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config>
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 <%@ page contentType="text/html" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %> <core:view> <html:form> <html:dataTable binding="#{bank.dataTable}" value="#{bank.customers}" var="customer" border="1"> <html:column> <html:outputText value="#{customer.name}"/> </html:column> <html:column> <html:outputText value="#{customer.forname}"/> </html:column> </html:dataTable> </html:form> </core:view>
Bank.java
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 package com.facestut.bean; import java.util.ArrayList; import java.util.List; import javax.faces.component.UIData; import javax.faces.component.UISelectBoolean; public class Bank { private List customers = new ArrayList(); public Bank() { this.customers.add(new Customer("DURAND","Paul")); this.customers.add(new Customer("DUDULE","Michel")); this.customers.add(new Customer("MARTIN","Athur")); this.customers.add(new Customer("RICARD","Paul")); } public List getCustomers(){ return this.customers; } public void setCustomers(List customers){ this.customers = customers; } // UIData ancêtre de HtmlDataTable private UIData dataTable; public UIData getDataTable(){ return this.dataTable; } public void setDataTable(UIData dataTable){ this.dataTable = dataTable; } private UISelectBoolean checkbox; public UISelectBoolean getCheckbox(){ return this.checkbox; } public void setCheckbox(UISelectBoolean checkbox){ this.checkbox = checkbox; } public void removeSelectedCustomers(){ int size = this.dataTable.getRowCount(); List selectedCustomers = new ArrayList(); for(int i=0; i < size; i++){ this.dataTable.setRowIndex(i); if(this.checkbox.isSelected()){ selectedCustomers.add(this.customers.get(i)); } } this.customers.removeAll(selectedCustomers); } public void addCustomer(){ Customer customer = new Customer(); customer.setName("Nouveau"); customer.setForname("client"); this.customers.add(customer); } }
Customer.java
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 package com.facestut.bean; public class Customer { private String name = "DURAND"; private String forname = "Paul"; public Customer() { } public Customer(String name, String forname) { this.name=name; this.forname=forname; } ////// les getters et setters////////: public String getName(){ return this.name; } public void setName(String value){ this.name = value; } public String getForname(){ return this.forname; } public void setForname(String value){ this.forname = value; } }
Merci bcp pour votre aide
ps :jai bien declaré les beans managé et J'utilise Eclipse 3.4 et jsf 1.2![]()
Partager