I'm in the process of learning JSF 2.1, and the "flash" scope seems to overlap other scopes. Does this bring any value, or should I disregard it as a modern GOTO: statement? Does it have a higher usage? Is it preferable to use over other types of scope (view, request, etc)?
Asked
Active
Viewed 1,375 times
1 Answers
4
It's main usage is as follows:
- you submit a form
- it is handled by an action method in a managed bean
- then a redirecting navigation rule is returned
- you need to show an object obtained in the action method on the result page
If it weren't for the flash scope, you would either need to pass the result in a serialized form in the URL, or use forward rather than redirect. But this is bad user experience (if he presses refresh)

Bozho
- 588,226
- 146
- 1,060
- 1,140
-
4It would be nice if the flash scope actually worked in any of the current JSF implementations. – Mike Braun Jun 21 '11 at 07:50
-
@Bozho why do you say that is will be bad user experience if you press refresh ? – Geek Nov 06 '12 at 09:18
-
because a "do you want to resubmit the form" dialog will appear. – Bozho Nov 06 '12 at 11:56