2

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)?

CIOC
  • 1,385
  • 3
  • 19
  • 48

2 Answers2

9

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:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • In your answer you say _"...a managed bean which should live as long as you're navigating through the specified collection of views..."_. What about **more than one managed bean** working with a collection of views? Will `@FlowScoped` handle such a scenario? – AlexSC Nov 01 '18 at 13:21
  • @AlexSC: There's no difference. Just give them all the same scope and if necessary simply inject the one in the other. How to choose the bean scope is answered in https://stackoverflow.com/q/7031885 – BalusC Nov 01 '18 at 13:56
1

Faces flow and navigation are different. Face flow like business flow in the frond end site, much like wizard.

Armen Arzumanyan
  • 1,939
  • 3
  • 30
  • 56