Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.1-core
-
None
-
None
Description
There are usecases where a custom tag that provides the ability to load dynamic layouts (or page fragments) based on app flow, requiring that new components be re-created when the tag is executed and a new layout different from the current one needs to be loaded.
Merely deleting the component sub-trees in the tag handler does not entirely address the issue because when the tag is re-executed today, if a binding EL is set on the component, then the component instance held by the backing bean instance (typically a reuqest scoped bean) get reused instead of a new component being created.
In order to force create the component instance, this new API will allow tag handlers to notify the framework by starting a new "component binding context". Between a pair of push and pop calls, component bindings will be cleared allowing for new component instances to be created and pushed to the backing bean.
/**
- Starts a new component binding context. Typically called from tag handlers when component
- bindings in its subtree needs to be cleared, forcing the creation of new components.
- @param context FacesContext instance
- @see RequestContext#popComponentBindingContext
- @see RequestContext#isInComponentBindingContext
*/
public static void pushComponentBindingContext(FacesContext context)
{
}
/**
- Pops out of the last pushed component binding context. Component binding instances will not be
- cleared after popping out the outermost context.
- @param context FacesContext instance
- @see RequestContext#pushComponentBindingContext
- @see RequestContext#isInComponentBindingContext
*/
public static void popComponentBindingContext(FacesContext context)
{
}
/**
- Returns true if we are currently within a component binding context.
- @see RequestContext#pushComponentBindingContext
- @see RequestContext#popComponentBindingContext
*/
public static boolean isInComponentBindingContext(FacesContext context)
{
}