Bonjour,

je ne comprend pas le comportement de commandLink dans certains cas, voici mon exemple :

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
<!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:ui="http://java.sun.com/jsf/facelets">
<head>
<title>Site de petites annonces</title>
</head>
<body>
	<f:view>
		<h:form>
			<h:commandLink action="go_announcements" value="Retour aux annonces" />
		</h:form>

		<ui:repeat value="#{annonce_manager.listAnnonces}" var="a">

			<h:panelGroup rendered="#{a.id eq param.id}">
				<h:panelGroup rendered="#{a.email ne client.email}">
					<h3>Détail de l'annonce #{a.titre}</h3>

					<ul>
						<li>#{a.date}</li>
						<li>#{a.description}</li>
						<li>#{a.prix}</li>
					</ul>
					<h:panelGroup rendered="#{client.connecte ne 1}">
						
<!--méthode provisoire qui marche-->
<!--<h:outputLink value="login.xhtml">Connectez-vous pour faire une proposition</h:outputLink>-->
						<h:form>
							<h:commandLink action="go_login" value="Connectez-vous pour faire une proposition" />
						</h:form>
					</h:panelGroup>

					<h:panelGroup rendered="#{client.connecte eq 1}">
						<h:outputLink value="proposal_create.xhtml?id=#{a.id}">Faire une proposition</h:outputLink>
					</h:panelGroup>
				</h:panelGroup>
			</h:panelGroup>
		</ui:repeat>
	</f:view>
</body>
</html>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
	<navigation-rule>
		<display-name>announcement_see.xhtml</display-name>
		<from-view-id>/announcement_see.xhtml</from-view-id>
		<navigation-case>
			<from-outcome>go_announcements</from-outcome>
			<to-view-id>/announcements.xhtml</to-view-id>
		</navigation-case>
		<navigation-case>
			<from-outcome>go_login</from-outcome>
			<to-view-id>/login.xhtml</to-view-id>
		</navigation-case>
	</navigation-rule>
La redirection du premier commandLink marche très bien. La redirection du deuxième commandLink vers la page de login en revanche ne marche pas : la page courante est rechargée avec la perte des paramètres post contenu dans param.

Du coup y'a t-il une subtilité pour ces commandLink, ne pas les mettre dans telle ou telle balise etc ?

Merci