Advantages of using JSF Faces Flow instead of the normal navigation system
Asked Answered
G

2

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

Grecism answered 30/1, 2015 at 16:50 Comment(0)
D
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:

Deneb answered 30/1, 2015 at 17:14 Comment(2)
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?Teletype
@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://mcmap.net/q/16959/-how-to-choose-the-right-bean-scopeDeneb
S
1

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

Scratch answered 2/2, 2015 at 11:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.