Bonjour, est il possible de retrouver la règle de navigation courante dans le managed bean, et particulièrement le "from-outcome" ?
Version imprimable
Bonjour, est il possible de retrouver la règle de navigation courante dans le managed bean, et particulièrement le "from-outcome" ?
Hello,
J'ai un bout de code dans mon projet (je n'en suis pas l'auteur), mais je pense que ça peut répondre à ta question :
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext context = (ExternalContext) facesContext.getExternalContext(); ApplicationAssociate associate = (ApplicationAssociate) context.getApplicationMap().get("com.sun.faces.ApplicationAssociate"); if (associate == null) { logger.error("Unable to get navigation page list."); return; } String currentPageViewId = facesContext.getViewRoot().getViewId(); Map navigationCases = associate.getNavigationCaseListMappings(); Iterator it = navigationCases.entrySet().iterator(); boolean found = false; String foundOutCome = null; while ((!found) && (it.hasNext())) { Entry currentEntry = (Entry) it.next(); List current = (List) currentEntry.getValue(); for (int i = 0; !found && (i < current.size()); i++) { ConfigNavigationCase navigationCase = (ConfigNavigationCase) current.get(i); if (navigationCase.getToViewId().equals(currentPageViewId)) { foundOutCome = navigationCase.getFromOutcome(); found = true; } } }
Bon, tout n'est pas bon à prendre (en particulier les tests dans la boucle for) mais le principe est là...
Merci beaucoup ! C'est bien ça que je cherchais.