Bonjour,
j'essaie de faire un menu avec dropdownmenu. mais lorsque je clique sur un élément de mon menu, toute la page est rafraichi . du coup, je ne vois plus le menu et les autres éléments. seule la page définit dans le navigation rules est affiché.
environnement technique : tomcat 7 - jsf 2 , richfaces 4.3
Voici les différents codes
index.xhtml
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 <!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <ui:composition template="/templates/structure.xhtml"> <ui:define name="businessZone"> <ui:include src="/pages/accueil/content.xhtml" /> </ui:define> </ui:composition> </html>
structure.xhtml
menu.xhtml
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 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:fn="http://java.sun.com/jsp/jstl/functions"> <ui:composition> <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Cache-Control" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Cache" content="no store" /> <meta http-equiv="Expires" content="0" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Page-Enter" content="blendTrans(Duration=0)" /> <meta http-equiv="Page-Exit" content="blendTrans(Duration=0)" /> <title>Checkforbet -</title> <h:outputStylesheet library="css" name="generale.css" /> <h:outputStylesheet library="css" name="index.css" /> </h:head> <h:body> <rich:panel styleClass="page"> <rich:panel styleClass="entete"> <ui:include src="../pages/accueil/header.xhtml" /> </rich:panel> <rich:panel styleClass="entete"> <ui:include src="../pages/accueil/menu.xhtml" /> </rich:panel> <rich:panel id="businessZoneOutpulPanel" styleClass="container"> <ui:insert name="businessZone" /> </rich:panel> <rich:panel styleClass="piedDePage"> <ui:include src="../pages/accueil/foot.xhtml" /> </rich:panel> </rich:panel> </h:body> </ui:composition> </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
32
33
34 <!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <ui:composition> <h:form id="menuFormId"> <rich:toolbar height="26px"> <rich:dropDownMenu mode="ajax"> <f:facet name="label"> <h:panelGroup> <h:outputText value="Accueil" /> </h:panelGroup> </f:facet> <rich:menuItem submitMode="ajax" action="#{utilisateurCtrl.doLoginUtilisateur}" reRender="businessZoneOutpulPanel" limitToList="true"> <h:outputText value="Accueil" /> </rich:menuItem> </rich:dropDownMenu> </rich:toolbar> </h:form> </ui:composition> </html>
faces-config.xhtml
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"?> <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude" 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"> <!-- JSF and Spring are integrated --> <application> <el-resolver> org.springframework.web.jsf.el.SpringBeanFacesELResolver </el-resolver> </application> <navigation-rule> <navigation-case> <from-action>#{utilisateurCtrl.doLoginUtilisateur}</from-action> <from-outcome>success</from-outcome> <to-view-id>/pages/accueil/test.xhtml</to-view-id> </navigation-case> </navigation-rule> </faces-config>
test.xhtml
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 <!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <!-- <ui:composition template="/templates/structure.xhtml"> --> <ui:composition> <!-- <a4j:outputPanel id="businessZoneOutpulPanel"> --> <!-- <rich:panel styleClass="main_content"> --> <rich:panel styleClass="container"> ça fonctionne si tu vois le menu </rich:panel> </ui:composition> </html>
Merci de votre aide
Partager