Bonjour/Bonsoir
Je me demandais comment récupérer un paramètre en entrée de flow issue de la page qui a appelé l'entrée dans le flow.
Donc la piste de flash jsf n'etait pas possible car le flash ne garde pas les valeurs quand il y a un changement d'URL d'une requête à l'autre.
Ainsi voici ma solution
Code html : 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 <?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"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core"> <h:head><title>IGNORED</title></h:head> <h:body> <ui:composition template="/WEB-INF/templates/default/masterLayout.xhtml"> <ui:define name="windowTitle">#{msgs['hello.world']}</ui:define> <ui:define name="content"> <p:panelGrid columns="1"> <f:facet name="footer"> <p:panel> <h:outputLink value="register"> [<u><h:outputText value="#{msgs['register.label']}"/></u>] <f:param name="from" value="#{facesContext.externalContext.request.requestURL}"/> </h:outputLink> </p:panel> </f:facet> </p:panelGrid> </ui:define> </ui:composition> </h:body> </html>
Code html : 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 <?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"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <h:head> <title>IGNORED</title> </h:head> <h:body> <ui:composition template="/WEB-INF/templates/default/noSideLayout.xhtml"> <ui:define name="windowTitle">#{msgs['register.label']}</ui:define> <ui:define name="content"> <h:form id="register_form"> <p:panel id="register_panel" header="#{msgs['register.label']}" style="margin-bottom:10px;"> <!-- code pas utile --> <f:facet name="footer"> <p:commandButton id="cancelRegistration" action="cancelRegistration" value="#{msgs['register.cancel.button']}" immediate="true"/> <p:commandButton id="reviewRegistration" action="validateRegistration" value="#{msgs['register.label']}" update="@form"/> </f:facet> </p:panel> </h:form> </ui:define> </ui:composition> </h:body> </html>
Code xml : 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 <?xml version="1.0" encoding="UTF-8"?> <flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"> <on-start> <evaluate expression="requestParameters?.from" result="flowScope.from"/> </on-start> <view-state id="enterRegistration"> <transition on="cancelRegistration" to="registrationCancelled"/> <transition on="validateRegistration" to="reviewRegister"/> </view-state> <view-state id="reviewRegister"> </view-state> <end-state id="registrationCancelled" view="externalRedirect:#{from}"/> <end-state id="registrationConfirmed" commit="true" view="externalRedirect:#{from}"/> </flow>
donc ça marche le seul problème qui subsiste c'est si je rentre dans le flow par exemple par une url qui rentre directement dans une étape du flow du style "..../register?execution=e3s1" alors dans ce cas la fin d’exécution me garde dans le flow... comme ce n'est pas un comportement naturel... je laisse ça de coté enfin si une personne a une idée je suis preneur.
Partager