Bonjour à tous,
je préviens tout de suite, j'ai un problème de newbie mais ça fait des heures que je suis dessus et j'ai la tête qui explose, alors je viens mendier un peu d'aide
je suis en train de découvrir JSF et le framework primeface, enfin j'aimerais bien les découvrir mais pour ça, il faudrait que j'arrive à faire une installation qui fonctionne...
J'utilise Eclipse Helios, et j'ai créé un projet Web dynamic en précisant l'utilisation de JSF 2.0 en configuration. J'ai opté pour Apache Myface au pif (je sais pas si ça a vraiment une influence d'utiliser Myface plutôt que Mojarra...) et j'ai ajouté Primeface au classpath.
Je me suis aidée d'un tuto pour créer les différentes parties du projet.
Au final, quand j'ai lancé l'application la première fois, j'ai obtenu le message d'erreur suivant :
après quelques recherches sur le net, j'ai compris qu'il me manquait les jar de jstl.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config Caused by: java.lang.NoClassDefFoundError - javax/servlet/jsp/jstl/core/Config
J'ai donc ajouté les jars jstl-api-1.2.jar et standard.jar à mon dossier WEB-INF/lib et j'ai redéployé l'application.
Cette fois, l'erreur est la suivante :
Je ne comprends pas pourquoi en ajoutant deux jars d'un coup la ressource n'est plus disponible alors qu'elle l'était avant...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Etat HTTP 404 - /tuto_JSF1/list.jsf type Rapport d''état message /tuto_JSF1/list.jsf description La ressource demandée (/tuto_JSF1/list.jsf) n'est pas disponible.
Bref, vu le nombre de gens qui disent que c'est très facile à installer, je me dis que je suis complètement à côté de la plaque et que j'ai loupé un truc de base, mais j'ai beau chercher un peu partout, je comprends pas quoi.
Merci d'avance pour toute l'aide que vous pourrez m'apporter.
En cas de besoin :
mon web.xml:
mon face-config.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
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 <?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_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>tuto_JSF1</display-name> <welcome-file-list> <welcome-file>index.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> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>resources.application</param-value> </context-param> <context-param> <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <description> This parameter tells MyFaces if javascript code should be allowed in the rendered HTML output. If javascript is allowed, command_link anchors will have javascript code that submits the corresponding form. If javascript is not allowed, the state saving info and nested parameters will be added as url parameters. Default is 'true' </description> <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name> <param-value>true</param-value> </context-param> <context-param> <description> If true, rendered HTML code will be formatted, so that it is 'human-readable' i.e. additional line separators and whitespace will be written, that do not influence the HTML code. Default is 'true' </description> <param-name>org.apache.myfaces.PRETTY_HTML</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name> <param-value>false</param-value> </context-param> <context-param> <description> If true, a javascript function will be rendered that is able to restore the former vertical scroll on every request. Convenient feature if you have pages with long lists and you do not want the browser page to always jump to the top if you trigger a link or button action that stays on the same page. Default is 'false' </description> <param-name>org.apache.myfaces.AUTO_SCROLL</param-name> <param-value>true</param-value> </context-param> <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> </web-app>
le index.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 <?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_2_0.xsd" version="2.0"> <managed-bean> <managed-bean-name>applicationCtrl</managed-bean-name> <managed-bean-class>web.ApplicationCtrl</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> </faces-config>
et le list.jsf :
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 <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>tuto JSF1</title> </head> <body> <jsp:forward page="faces/list.jsf" /> </body> </html>
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 <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui"> <h:head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>tuto JSF 1</title> </h:head> <h:body> <f:view> <h:dataTable border="0" rules="all" value="#{applicationCtrl.personnes }" var="p"> <h:column> <f:facet name="header"> <h:outputText value="Prénom"/> </f:facet> <h:outputText value="#{p.prenom }" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Nom"/> </f:facet> <h:outputText value="#{p.nom }" /> </h:column> </h:dataTable> </f:view> </h:body> </html>
Partager