问题
I'm exploring the JSF 2.2 Faces Flow feature but I'm still not sure what are the advantages of defining a flow using Faces Flow instead of using the normal navigation system (calling facelets in links or buttons)?
回答1:
Only use it if you want to use a @FlowScoped
bean on a given set of views. In other words, only use it if you want a managed bean which should live as long as you're navigating through the specified collection of views registered in the flow configuration file.
There are indeed very few real world use cases for this. They all boil down to a multi-step wizard of which each step is bookmarkable. Previously, before the introduction of the flow scope, one would use conditionally rendered includes for this, but they are in turn not individually bookmarkable, because the URL stays the same all the time.
See also:
- What is new in JSF 2.2? - Faces Flow
- Java EE 7 tutorial - Using Faces Flows
- How to navigate in JSF? How to make URL reflect current page (and not previous one)
回答2:
Faces flow and navigation are different. Face flow like business flow in the frond end site, much like wizard.
来源:https://stackoverflow.com/questions/28240734/advantages-of-using-jsf-faces-flow-instead-of-the-normal-navigation-system