Bonjour,
je débute avec jsf -richfaces et a4j.
J'ai crée un nouveau projet avec eclipse.
Donc j'ai rajouté les librairies dans le web-inf/lib :
jsf-api.jar
jsf-impl.jar
jstl-1.1.0.jar
richfaces-api-3.3.2.SR1.jar
richfaces-impl-3.3.2.SR1.jar
richfaces-ui-3.3.2.SR1.jar
et les commons....
voici mon web.xml :
mon faces-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 <?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>jsf-greeting</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>*.jsf</url-pattern> </servlet-mapping> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> </web-app>
dans ma page 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 <?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>account</managed-bean-name> <managed-bean-class>data.Account</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <navigation-rule> <from-view-id>/faces/greeting.jsp</from-view-id> <navigation-case> <from-outcome>HelloWorld</from-outcome> <to-view-id>test.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config>
le souci c'est lorsque je clique sur la textbox, il y a une erreur javascript : a4j undefined.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <h:inputText id="textBox"> <a4j:support event="onclick" action="#{account.textBoxLostFocus}" reRender="testJSF"/> </h:inputText>
je vois pas ce qu'il manque.
J'ai rajouté à chaque entete de la page jsp :
je sais pas trop ce qu'il manque.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
voici le code jsp complet :
Avec eclipse, avec la complétion, j'obtiens bien les balises a4j.
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 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%> <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script language="javascript"> function onBlurJSF() { alert("fonction onBlur active"); } function onDblClickJSF() { alert("fonction onDblClick active"); } </script> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <f:view> <f:loadBundle basename="properties.messages" var="message"/> <p><h:outputText value="#{message.greeting}" /></p> <h:outputText value="Le numéro de compte :" /> <h:outputText value="#{accountDatas.number}" /> <h:form> <br/> <h:inputText id="textBox"> <a4j:support event="onclick" action="#{account.textBoxLostFocus}" reRender="testJSF"/> </h:inputText> </h:form> </f:view> </body> </html>
merci d'avance
En
Partager