Bonjour les développeur,
Je rale un petit peu sur un menu crée dans une classe java et appelé dans des .xhtml, La 1ere fois c'est bon le menu est visible mais si je quitte vers une autre page qui a le meme menu ou meme retourne sur ma page ce menu me cause des probleme (ce qui veut dire une page plein d'erreures )
voila mon 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
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
 
 
@ManagedBean
@SessionScoped
public class BloggerBean {
 
	private MenuModel menuhorizental = new DefaultMenuModel();
 
	public BloggerBean() {
		MenuItem menuItem = new MenuItem();
		menuItem.setValue("Répondre questionnaire");
		menuItem.setUrl("#");
		menuhorizental.addMenuItem(menuItem);
 
		menuItem = new MenuItem();
		menuItem.setValue("Modifier Information");
		menuItem.setUrl("#");
		menuhorizental.addMenuItem(menuItem);
 
		menuItem = new MenuItem();
		menuItem.setValue("Nouvel personne rencontrée");
		menuItem.setUrl("#");
		menuhorizental.addMenuItem(menuItem);
 
		menuItem = new MenuItem();
		menuItem.setValue("Nouveau participant");
		menuItem.setUrl("#");
		menuhorizental.addMenuItem(menuItem);
 
		Audit a = new Audit();
		FacesContext context = FacesContext.getCurrentInstance();
		HttpSession session = (HttpSession) context.getExternalContext()
				.getSession(true);
		a = (Audit) session.getAttribute("audit");
		if (a.getStatu().getLibelle() == "Rapport validé") {
			menuItem = new MenuItem();
			menuItem.setValue("Génerer rapport");
			menuItem.setUrl("#");
			menuhorizental.addMenuItem(menuItem);
		} else if (a.getStatu().getLibelle() == "PMC reçu") {
			menuItem = new MenuItem();
			menuItem.setValue("Saisir analyse PMC");
			menuItem.setUrl("#");
			menuhorizental.addMenuItem(menuItem);
 
		} else if (a.getStatu().getLibelle() == "PMC analysé") {
			menuItem = new MenuItem();
			menuItem.setValue("Imprimer analyse PMC");
			menuItem.setUrl("#");
			menuhorizental.addMenuItem(menuItem);
		} else if (a.getStatu().getLibelle() == "Suivi en cours") {
			menuItem = new MenuItem();
			menuItem.setValue("Génerer fiche de suivie");
			menuItem.setUrl("#");
			menuhorizental.addMenuItem(menuItem);
 
 
			Utilisateur u = new Utilisateur();
			HttpSession sessionU = (HttpSession) context.getExternalContext()
					.getSession(true);
			u = (Utilisateur) sessionU.getAttribute("user");
			if (a.getUtilisateur() == u) {
				menuItem = new MenuItem();
				menuItem.setValue("Valider fiche suivie");
				menuItem.setUrl("#");
				menuhorizental.addMenuItem(menuItem);
			}
			menuItem = new MenuItem();
			menuItem.setValue("Cloturer le suivi");
			menuItem.setUrl("#");
			menuhorizental.addMenuItem(menuItem);
		}
	}
 
	public MenuModel getMenuHorizental() {
		return menuhorizental;
	}
}
j'appel le menu comme ça

<p:menubar model="#{bloggerBean.menuHorizental}" />


et finalement le log :

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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
 
juin 15, 2012 12:57:56 PM com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent
Avertissement: Impossible de détecter le composant dont l’ID est «idaut» dans la vue.
juin 15, 2012 12:57:56 PM com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent
Avertissement: Impossible de détecter le composant dont l’ID est «dateaud» dans la vue.
juin 15, 2012 12:57:56 PM com.sun.faces.util.Util checkIdUniqueness
Grave: JSF1007 : ID de composant j_id2 en double dans la vue.
juin 15, 2012 12:57:56 PM com.sun.faces.util.Util checkIdUniqueness
Grave: +id: j_id1
 type: javax.faces.component.UIViewRoot@18ade03
  +id: javax_faces_location_HEAD
   type: com.sun.faces.component.ComponentResourceContainer@1093702
    +id: j_id2  <===============
     type: javax.faces.component.UIOutput@1fa7a60
    +id: j_id3
     type: javax.faces.component.UIOutput@1786afb
    +id: j_id4
     type: javax.faces.component.UIOutput@b7a33d
  +id: j_idt1
   type: <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
  +id: j_idt2
   type: <html xmlns="http://www.w3.org/1999/xhtml">
 
  +id: j_idt3
   type: javax.faces.component.UIOutput@3e2a5f
    +id: j_idt4
     type: 
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<link href="./resources/css/css.css" rel="stylesheet" type="text/css"/>
 
  +id: j_idt5
   type: javax.faces.component.UIOutput@14ff977
    +id: j_idt6
     type: 
	<div id="topmenu" class="topmenu">
		<!-- letete -->
		<div class="topban" id="topban">
			<object dir="ltr" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="120">
 
				<param name="quality" value="high"/>
				<embed src="img/clouds.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="120"/>
			</object>
		</div>
		<div class="user" id="user">
			<script type="text/javascript" src="./resources/js/time.js"/>
			Bonjour
 
    +id: j_idt7
     type: javax.faces.component.html.HtmlOutputText@182ff96
    +id: j_idt8
     type: 
			<a href="#" onclick="#{utilisateurBean.deconnecter}"> <img src="img/LogOff.png" width="20px" height="20px"/></a>
		</div>
		<ul class="glossymenu">
			<li class="current"><a href="#"><b>Acceuil</b></a></li>
			<li><a href="InfoUtilisateur.xhtml"><b>Tableau de bord</b></a></li>
		</ul>
 
	</div>
 
	<table style="margin-left: 13%; margin-right: 14%; margin-top: 20px; width: 72%;">
		<tr valign="top">
			<td>
				<div id="left">
					<div id="contenumenu" class="contenumenu">
 
 
    +id: j_idt9
     type: 
 
					</div>
				</div>
			</td>
			<td>
				<div id="corps">
					<div id="contenucorps" class="contenucorps">
 
    +id: j_idt10
     type: org.primefaces.component.menubar.Menubar@159d2a7
      +id: j_id2  <===============
       type: org.primefaces.component.menuitem.MenuItem@14d8ca
      +id: j_id3
       type: org.primefaces.component.menuitem.MenuItem@a4b7dd
      +id: j_id4
       type: org.primefaces.component.menuitem.MenuItem@2349fe
      +id: j_id5
       type: org.primefaces.component.menuitem.MenuItem@cef922
    +id: j_idt11
     type: 
                Bonjour 
    +id: j_idt12
     type: javax.faces.component.html.HtmlOutputText@46413d
    +id: j_idt13
     type: javax.faces.component.html.HtmlForm@652594
      +id: panel
       type: org.primefaces.component.panel.Panel@862930
        +id: j_idt14
         type: org.primefaces.component.messages.Messages@1fa1df7
        +id: j_idt15
         type: javax.faces.component.html.HtmlPanelGrid@12d0914
          +id: j_idt16
           type: javax.faces.component.html.HtmlOutputLabel@1c581b1
          +id: j_idt17
           type: javax.faces.component.html.HtmlOutputText@1c5959b
          +id: j_idt18
           type: javax.faces.component.html.HtmlOutputLabel@e0f926
          +id: iddate
           type: javax.faces.component.html.HtmlOutputText@55b60
          +id: j_idt19
           type: javax.faces.component.html.HtmlOutputLabel@1b208f8
          +id: organismeAudite
           type: javax.faces.component.html.HtmlOutputText@16afdbc
          +id: j_idt20
           type: javax.faces.component.html.HtmlOutputLabel@1384fb4
          +id: statut
           type: javax.faces.component.html.HtmlOutputText@1f8b933
    +id: basic
     type: org.primefaces.component.datatable.DataTable@46faa6
      +id: j_idt21
       type:   
           Les personnes rencontree dans audit selectionné 
 
      +id: modelHeader
       type: org.primefaces.component.column.Column@1f1b3b7
        +id: j_idt22
         type:   
                    ID  
 
        +id: j_idt23
         type: javax.faces.component.html.HtmlOutputText@14dba87
      +id: j_idt24
       type: org.primefaces.component.column.Column@113242
        +id: j_idt25
         type:   
                    Nom  
 
        +id: j_idt26
         type: javax.faces.component.html.HtmlOutputText@fa934b
      +id: j_idt27
       type: org.primefaces.component.column.Column@dc4e90
        +id: j_idt28
         type:   
                    Prenom  
 
        +id: j_idt29
         type: javax.faces.component.html.HtmlOutputText@1a9e5eb
      +id: j_idt30
       type: org.primefaces.component.column.Column@135db71
        +id: j_idt31
         type:   
                    Titre  
 
        +id: j_idt32
         type: javax.faces.component.html.HtmlOutputText@da13d5
    +id: basic2
     type: org.primefaces.component.datatable.DataTable@14c16d3
      +id: j_idt33
       type:   
           Les personnes participants dans audit selectionné 
 
      +id: modelHeader
       type: org.primefaces.component.column.Column@6e84a5
        +id: j_idt34
         type:   
                    ID  
 
        +id: j_idt35
         type: javax.faces.component.html.HtmlOutputText@1c67d45
      +id: j_idt36
       type: org.primefaces.component.column.Column@4a599e
        +id: j_idt37
         type:   
                    Nom  
 
        +id: j_idt38
         type: javax.faces.component.html.HtmlOutputText@141b926
      +id: j_idt39
       type: org.primefaces.component.column.Column@1e27289
        +id: j_idt40
         type:   
                    Prenom  
 
        +id: j_idt41
         type: javax.faces.component.html.HtmlOutputText@1cd9e0f
      +id: j_idt42
       type: org.primefaces.component.column.Column@440c89
        +id: j_idt43
         type:   
                    Statut  
 
        +id: j_idt44
         type: javax.faces.component.html.HtmlOutputText@19307f2
    +id: j_idt45
     type: 
					</div>
				</div>
			</td>
		</tr>
	</table>
	<div id="bottom" style="background-color: rgb(58, 64, 67)">
 
    +id: j_idt46
     type: 
			<p style="margin-right: 8%; margin-left: 8%">Bottom de la
				template</p>
 
    +id: j_idt47
     type: 
	</div>
 
  +id: j_idt48
   type: 
 
</html>
 
juin 15, 2012 12:57:56 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
Grave: Error Rendering View[/BordAudit.xhtml]
java.lang.IllegalStateException: L’ID de composant «j_id2» a déjà été détecté dans la vue.
	at com.sun.faces.util.Util.checkIdUniqueness(Util.java:821)
	at com.sun.faces.util.Util.checkIdUniqueness(Util.java:805)
	at com.sun.faces.util.Util.checkIdUniqueness(Util.java:805)
	at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:144)
	at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133)
	at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:418)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
	at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
 
juin 15, 2012 12:57:56 PM org.apache.catalina.core.StandardWrapperValve invoke
Grave: Servlet.service() for servlet [Faces Servlet] in context with path [/dac_web_Mar] threw exception [L’ID de composant «j_id2» a déjà été détecté dans la vue.] with root cause
java.lang.IllegalStateException: L’ID de composant «j_id2» a déjà été détecté dans la vue.
	at com.sun.faces.util.Util.checkIdUniqueness(Util.java:821)
	at com.sun.faces.util.Util.checkIdUniqueness(Util.java:805)
	at com.sun.faces.util.Util.checkIdUniqueness(Util.java:805)
	at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:144)
	at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133)
	at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:418)
	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
	at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
d'aprés ce que j'ai compris c'est comme si le menu est appelé plus d'une fois!!!
enfin je crois.
Merci d'avance