Adding flash scope variables (JSF 2.0)
You can pass temporary objects between views using flash
scope variables. Flash scope is useful if you want to enter data on
a page and have the data available for the next request, but not for
subsequent requests.
About this task
Procedure
- In the Page Data view, right-click the Flash Variables node and select .
- In the Name field, enter the name of the variable.
- In the Type field, enter a Java type or click the ... button to open the Choose Java Type dialog box where you can enter the first few characters of the type you want to select.
- Click OK.
Results
What to do next
Note: If
you want the values in the flash variable to persist for another post-redirect-get
cycle, use the keep keyword, for example#{flash.keep.myBean.textContent}.
You can use the ExternalContext.getFlash() API to access your flash
variable programmatically in an action method, or you can use EL expressions
to access the values in your flash variables.