Bonsoir,
aprés la proposition de djo.mos voilà que je pose ma question clairement.
j'utilise eclipse europa 3.3,jsf1.2,facelet 3 et richFaces pour mettre en place un menu vertical.
j'ai volu faire mon composant personalisé donc j'ai developpé un premier fichier menu.xml sous le rep /WEB-INF/composant:
ensuite le fichier menu.taglib.xml sous le rep /WEB-INF:
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 <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"> <ui:composition <style> .cols { vertical-align: top; width: 50%; } </style> <h:form id="form"> <h:panelGrid columns="2" columnClasses="cols" width="100%"> <rich:panelMenu style="width:200px" mode="ajax" iconExpandedGroup="disc" iconCollapsedGroup="disc" iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right" iconCollapsedTopGroup="chevronDown" iconCollapsedTopPosition="right"> <rich:panelMenuGroup label="Group 1"> <rich:panelMenuItem label="Item 1.1" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 1.1" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 1.2" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 1.2" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 1.3" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 1.3" /> </rich:panelMenuItem> </rich:panelMenuGroup> <rich:panelMenuGroup label="Group 2"> <rich:panelMenuItem label="Item 2.1" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.1" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 2.2" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.2" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 2.3" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.3" /> </rich:panelMenuItem> <rich:panelMenuGroup label="Group 2.4"> <rich:panelMenuItem label="Item 2.4.1" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.4.1" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 2.4.2" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.4.2" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 2.4.3" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.4.3" /> </rich:panelMenuItem> </rich:panelMenuGroup> <rich:panelMenuItem label="Item 2.5" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 2.5" /> </rich:panelMenuItem> </rich:panelMenuGroup> <rich:panelMenuGroup label="Group 3"> <rich:panelMenuItem label="Item 3.1" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 3.1" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 3.2" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 3.2" /> </rich:panelMenuItem> <rich:panelMenuItem label="Item 3.3" action="#{panelMenu.updateCurrent}"> <f:param name="current" value="Item 3.3" /> </rich:panelMenuItem> </rich:panelMenuGroup> </rich:panelMenu> <rich:panel> <a4j:outputPanel ajaxRendered="true"> <h:outputText value="#{panelMenu.current} selected" id="current" /> </a4j:outputPanel> </rich:panel> </h:panelGrid> </h:form> </ui:composition> </html>
et enfin j'ai appelé mon menu avec le fichier test.xhtml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?xml version="1.0"?> <!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "facelet-taglib_1_0.dtd"> <facelet-taglib> <namespace>http://www.developpez.com/jsfEtFacelets/menu</namespace> <tag> <tag-name>menu</tag-name> <source>composant/menu.xhtml</source> </tag> </facelet-taglib>
à l'execution tomcat m'affiche le message"mon menu" mais il n'affiche pas le menu.
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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:mj=" http://www.developpez.com/jsfEtFacelets/menu"> <head> <title>Ma premiere page XHTML avec facelets</title> </head> <body> <f:view> <h:outputText value="mon menu"/> <mj:menu /> </f:view> </body> </html>
la console eclipse affiche
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 4 avr. 2008 00:04:12 org.apache.tomcat.util.digester.SetPropertiesRule begin ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:DynamicMenu' did not find a matching property. 4 avr. 2008 00:04:12 org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.6.0_05\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jre1.6.0_05\bin\client;C:\Program Files\Java\jre1.6.0_05\bin;C:\jdk5\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\jdk1.5\bin;C:\ant\bin;
![]()
Partager