Bonjour,
Je suis en train de développer une application web avec RichFaces.
Je travaille avec une page XHTML et j'intègre RichFaces dans celle-ci.
Mon but serait de travailler avec des pages JSP + RichFaces plutôt que qu'avec des pages XHTML + RichFaces.
A titre d'exemple, je réalise une page d'authentification et j'arrive à authentifier avec succès grâce au Managed Bean (lié au JSF).
Le code de cette page est :Je veux juste rendre les balises de RichFaces supportées par les 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 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <head> <title>Authentification</title> </head> <body> <h:outputText value="Login: "/> <h:inputText id="log" value="#{Verification.utilisateur.login}" /> <h:outputText value="Mot de passe:" /> <h:inputSecret id="mdp" value="#{Verification.utilisateur.password}"/> <a4j:commandButton id="ButtonID" value="Connection" action="#{Verification.val}" > </a4j:commandButton> </body> </html>
Donc cette page d'authentification doit devenir authentification.jsp et bien sûr, elle doit supporter les RichFaces (l'authentification reste identique : elle fait appel à la classe Verification).
Normalement, les lignes qui doivent être modifiées contiennent nécessairement ceciEt le fichier web.xml doit probablement subir quelques changements.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
L'ancienne version estPour que toutes les pages web s'exécutent avec l'extension .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 <?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>firstRichFaces</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> <context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>org.richfaces.CONTROL_SKINNING</param-name> <param-value>enable</param-value> </context-param> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>emeraldTown</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <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></web-app>
Merci d'avance
Partager