Class UIViewRoot
- java.lang.Object
- 
- jakarta.faces.component.UIComponent
- 
- jakarta.faces.component.UIComponentBase
- 
- jakarta.faces.component.UIViewRoot
 
 
 
- 
- All Implemented Interfaces:
- PartialStateHolder,- StateHolder,- TransientStateHolder,- UniqueIdVendor,- ComponentSystemEventListener,- FacesListener,- SystemEventListenerHolder,- EventListener
 
 @JSFComponent(name="f:view") @JSFJspProperty(name="binding", returnType="java.lang.String", tagExcluded=true) public class UIViewRoot extends UIComponentBase implements UniqueIdVendorCreates a Faces View, which is a container that holds all of the components that are part of the view.Unless otherwise specified, all attributes accept static values or EL expressions. See the javadoc for this class in the JSF Specification for further details. 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringCOMPONENT_FAMILYstatic StringCOMPONENT_TYPEstatic StringMETADATA_FACET_NAMEstatic StringUNIQUE_ID_PREFIXstatic StringVIEW_PARAMETERS_KEYstatic StringVIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS_PARAM_NAME- 
Fields inherited from class jakarta.faces.component.UIComponentATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY
 
- 
 - 
Constructor SummaryConstructors Constructor Description UIViewRoot()Construct an instance of the UIViewRoot.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComponentResource(FacesContext context, UIComponent componentResource)voidaddComponentResource(FacesContext context, UIComponent componentResource, String target)voidaddPhaseListener(PhaseListener phaseListener)Adds a The phaseListeners attached to ViewRoot.voidbroadcastEvents(FacesContext context, PhaseId phaseId)StringcreateUniqueId()Provides a unique id for this component instance.StringcreateUniqueId(FacesContext context, String seed)voidencodeBegin(FacesContext context)voidencodeChildren(FacesContext context)voidencodeEnd(FacesContext context)jakarta.el.MethodExpressiongetAfterPhaseListener()MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called after every phase except for restore view.Map<String,Object>getAttributes()Get a map through which all the UIComponent's properties, value-bindings and non-property attributes can be read and written.jakarta.el.MethodExpressiongetBeforePhaseListener()MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called before every phase except for restore view.List<UIComponent>getComponentResources(FacesContext context)List<UIComponent>getComponentResources(FacesContext context, String target)DoctypegetDoctype()Return the doctype of this view.StringgetFamily()LocalegetLocale()The locale for this view.List<PhaseListener>getPhaseListeners()StringgetRenderKitId()Defines what renderkit should be used to render this view.booleangetRendersChildren()Indicates whether this component or its renderer manages the invocation of the rendering methods of its child components.StringgetViewId()A unique identifier for the "template" from which this view was generated.List<SystemEventListener>getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent)Map<String,Object>getViewMap()Map<String,Object>getViewMap(boolean create)booleanisInView()Indicate if this component is inside a view, or in other words is contained by an UIViewRoot instance (which represents the view).voidprocessApplication(FacesContext context)voidprocessDecodes(FacesContext context)voidprocessRestoreState(FacesContext context, Object state)voidprocessUpdates(FacesContext context)This isn't an input component, so just pass on the processUpdates call to child components and facets that might be input components.voidprocessValidators(FacesContext context)voidqueueEvent(FacesEvent event)voidremoveComponentResource(FacesContext context, UIComponent componentResource)voidremoveComponentResource(FacesContext context, UIComponent componentResource, String target)voidremovePhaseListener(PhaseListener phaseListener)Removes a The phaseListeners attached to ViewRoot.voidresetValues(FacesContext context, Collection<String> clientIds)voidrestoreState(FacesContext facesContext, Object state)Invoked in the "restore view" phase, this initialises this object's members from the values saved previously into the provided state object.voidrestoreViewScopeState(FacesContext facesContext, Object state)ObjectsaveState(FacesContext facesContext)Invoked after the render phase has completed, this method returns an object which can be passed to the restoreState of some other instance of UIComponentBase to reset that object's state to the same values as this object currently has.voidsetAfterPhaseListener(jakarta.el.MethodExpression afterPhaseListener)SetsvoidsetBeforePhaseListener(jakarta.el.MethodExpression beforePhaseListener)SetsvoidsetDoctype(Doctype doctype)Set the doctype of this view.voidsetId(String id)Set an identifier for this component which is unique within the scope of the nearest ancestor NamingContainer component.voidsetInView(boolean isInView)Define if the component is on the view or not.voidsetLocale(Locale locale)voidsetRendered(boolean state)DO NOT USE.voidsetRenderKitId(String renderKitId)voidsetViewId(String viewId)voidsubscribeToViewEvent(Class<? extends SystemEvent> systemEvent, SystemEventListener listener)voidunsubscribeFromViewEvent(Class<? extends SystemEvent> systemEvent, SystemEventListener listener)- 
Methods inherited from class jakarta.faces.component.UIComponentBaseaddClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeAll, findComponent, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getPassThroughAttributes, getRenderer, getRendererType, invokeOnComponent, isRendered, isTransient, markInitialState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, visitTree
 - 
Methods inherited from class jakarta.faces.component.UIComponentgetClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setValueExpression, subscribeToEvent, unsubscribeFromEvent
 
- 
 
- 
- 
- 
Field Detail- 
COMPONENT_FAMILYpublic static final String COMPONENT_FAMILY - See Also:
- Constant Field Values
 
 - 
COMPONENT_TYPEpublic static final String COMPONENT_TYPE - See Also:
- Constant Field Values
 
 - 
METADATA_FACET_NAMEpublic static final String METADATA_FACET_NAME - See Also:
- Constant Field Values
 
 - 
UNIQUE_ID_PREFIXpublic static final String UNIQUE_ID_PREFIX - See Also:
- Constant Field Values
 
 - 
VIEW_PARAMETERS_KEYpublic static final String VIEW_PARAMETERS_KEY - See Also:
- Constant Field Values
 
 - 
VIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS_PARAM_NAME@JSFWebConfigParam(defaultValue="false", expectedValues="true, false", since="2.3") public static final String VIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS_PARAM_NAME- Since:
- 2.3
- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
addComponentResourcepublic void addComponentResource(FacesContext context, UIComponent componentResource) - Since:
- 2.0
 
 - 
addComponentResourcepublic void addComponentResource(FacesContext context, UIComponent componentResource, String target) - Since:
- 2.0
 
 - 
addPhaseListenerpublic void addPhaseListener(PhaseListener phaseListener) Adds a The phaseListeners attached to ViewRoot.
 - 
broadcastEventspublic void broadcastEvents(FacesContext context, PhaseId phaseId) - Since:
- 2.0
 
 - 
createUniqueIdpublic String createUniqueId() Provides a unique id for this component instance.
 - 
createUniqueIdpublic String createUniqueId(FacesContext context, String seed) - Specified by:
- createUniqueIdin interface- UniqueIdVendor
- Since:
- 2.0
 
 - 
encodeBeginpublic void encodeBegin(FacesContext context) throws IOException - Overrides:
- encodeBeginin class- UIComponentBase
- Throws:
- IOException
 
 - 
encodeChildrenpublic void encodeChildren(FacesContext context) throws IOException - Overrides:
- encodeChildrenin class- UIComponentBase
- Throws:
- IOException
- Since:
- 2.0
 
 - 
encodeEndpublic void encodeEnd(FacesContext context) throws IOException - Overrides:
- encodeEndin class- UIComponentBase
- Throws:
- IOException
 
 - 
getAfterPhaseListener@JSFProperty(returnSignature="void", methodSignature="jakarta.faces.event.PhaseEvent", stateHolder=true) public jakarta.el.MethodExpression getAfterPhaseListener()MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called after every phase except for restore view.- Returns:
- the new afterPhaseListener value
 
 - 
getBeforePhaseListener@JSFProperty(returnSignature="void", methodSignature="jakarta.faces.event.PhaseEvent", stateHolder=true) public jakarta.el.MethodExpression getBeforePhaseListener()MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called before every phase except for restore view.- Returns:
- the new beforePhaseListener value
 
 - 
getComponentResourcespublic List<UIComponent> getComponentResources(FacesContext context, String target) - Since:
- 2.0
 
 - 
getComponentResourcespublic List<UIComponent> getComponentResources(FacesContext context) - Parameters:
- context-
- Returns:
- Since:
- 2.3
 
 - 
getFamilypublic String getFamily() - Specified by:
- getFamilyin class- UIComponent
 
 - 
getLocale@JSFProperty public Locale getLocale() The locale for this view.Defaults to the default locale specified in the faces configuration file. 
 - 
getPhaseListenerspublic List<PhaseListener> getPhaseListeners() - Since:
- 2.0
 
 - 
getRenderKitId@JSFProperty public String getRenderKitId() Defines what renderkit should be used to render this view.
 - 
getRendersChildrenpublic boolean getRendersChildren() Description copied from class:UIComponentBaseIndicates whether this component or its renderer manages the invocation of the rendering methods of its child components. When this is true:- This component's encodeBegin method will only be called after all the child components have been created and added to this component.
- This component's encodeChildren method will be called after its encodeBegin method. Components for which this method returns false do not get this method invoked at all.
- No rendering methods will be called automatically on child components; this component is required to invoke the encodeBegin/encodeEnd/etc on them itself.
 - Overrides:
- getRendersChildrenin class- UIComponentBase
- Since:
- 2.0
 
 - 
getViewId@JSFProperty(tagExcluded=true) public String getViewId() A unique identifier for the "template" from which this view was generated.Typically this is the filesystem path to the template file, but the exact details are the responsibility of the current ViewHandler implementation. 
 - 
isInViewpublic boolean isInView() Indicate if this component is inside a view, or in other words is contained by an UIViewRoot instance (which represents the view). If this component is a UIViewRoot instance, the components "always" is on the view. By default it is false but for UIViewRoot instances is true.- Overrides:
- isInViewin class- UIComponent
- Returns:
 
 - 
processApplicationpublic void processApplication(FacesContext context) 
 - 
processDecodespublic void processDecodes(FacesContext context) - Overrides:
- processDecodesin class- UIComponentBase
 
 - 
processRestoreStatepublic void processRestoreState(FacesContext context, Object state) - Overrides:
- processRestoreStatein class- UIComponentBase
- Since:
- 2.0
 
 - 
queueEventpublic void queueEvent(FacesEvent event) - Overrides:
- queueEventin class- UIComponentBase
 
 - 
processValidatorspublic void processValidators(FacesContext context) - Overrides:
- processValidatorsin class- UIComponentBase
 
 - 
processUpdatespublic void processUpdates(FacesContext context) Description copied from class:UIComponentBaseThis isn't an input component, so just pass on the processUpdates call to child components and facets that might be input components.Components that were never rendered can't possibly be receiving update data (no corresponding fields were ever put into the response) so if this component is not rendered then this method does not invoke processUpdates on its children. - Overrides:
- processUpdatesin class- UIComponentBase
 
 - 
setLocalepublic void setLocale(Locale locale) 
 - 
setRenderKitIdpublic void setRenderKitId(String renderKitId) 
 - 
setRendered@JSFProperty(tagExcluded=true) public void setRendered(boolean state) DO NOT USE.This inherited property is disabled. Although this class extends a base-class that defines a read/write rendered property, this particular subclass does not support setting it. Yes, this is broken OO design: direct all complaints to the Faces spec group. - Overrides:
- setRenderedin class- UIComponentBase
 
 - 
setId@JSFProperty(tagExcluded=true) public void setId(String id) Description copied from class:UIComponentBaseSet an identifier for this component which is unique within the scope of the nearest ancestor NamingContainer component. The id is not necessarily unique across all components in the current view.The id must start with an underscore if it is generated by the Faces framework, and must not start with an underscore if it has been specified by the user (eg in a JSP tag). The first character of the id must be an underscore or letter. Following characters may be letters, digits, underscores or dashes. Null is allowed as a parameter, and will reset the id to null. The clientId of this component is reset by this method; see getClientId for more info. - Overrides:
- setIdin class- UIComponentBase
 
 - 
setInViewpublic void setInView(boolean isInView) Define if the component is on the view or not.This value is set in the following conditions: - Component / Facet added: if the parent isInView = true, set it to true and all their children or facets, otherwise take no action
- Component / Facet removed: if the parent isInView = false, set it to false and all their children or facets, otherwise take no action
 - Overrides:
- setInViewin class- UIComponent
 
 - 
removeComponentResourcepublic void removeComponentResource(FacesContext context, UIComponent componentResource) 
 - 
removeComponentResourcepublic void removeComponentResource(FacesContext context, UIComponent componentResource, String target) 
 - 
setViewIdpublic void setViewId(String viewId) 
 - 
removePhaseListenerpublic void removePhaseListener(PhaseListener phaseListener) Removes a The phaseListeners attached to ViewRoot.
 - 
setBeforePhaseListenerpublic void setBeforePhaseListener(jakarta.el.MethodExpression beforePhaseListener) Sets- Parameters:
- beforePhaseListener- the new beforePhaseListener value
 
 - 
setAfterPhaseListenerpublic void setAfterPhaseListener(jakarta.el.MethodExpression afterPhaseListener) Sets- Parameters:
- afterPhaseListener- the new afterPhaseListener value
 
 - 
getAttributespublic Map<String,Object> getAttributes() Description copied from class:UIComponentBaseGet a map through which all the UIComponent's properties, value-bindings and non-property attributes can be read and written.When writing to the returned map: - If this component has an explicit property for the specified key then the setter method is called. An IllegalArgumentException is thrown if the property is read-only. If the property is readable then the old value is returned, otherwise null is returned.
- Otherwise the key/value pair is stored in a map associated with the component.
 When reading from the returned map: - If this component has an explicit property for the specified key then the getter method is called. If the property exists, but is read-only (ie only a setter method is defined) then an IllegalArgumentException is thrown.
- If the attribute map associated with the component has an entry with the specified key, then that is returned.
- If this component has a value-binding for the specified key, then the value-binding is evaluated to fetch the value.
- Otherwise, null is returned.
 Assigning values to the map which are not explicit properties on the underlying component can be used to "tunnel" attributes from the JSP tag (or view-specific equivalent) to the associated renderer without modifying the component itself. Any value-bindings and non-property attributes stored in this map are automatically serialized along with the component when the view is serialized. - Overrides:
- getAttributesin class- UIComponentBase
 
 - 
resetValuespublic void resetValues(FacesContext context, Collection<String> clientIds) - Parameters:
- context-
- clientIds-
- Since:
- 2.2
 
 - 
saveStatepublic Object saveState(FacesContext facesContext) Description copied from class:UIComponentBaseInvoked after the render phase has completed, this method returns an object which can be passed to the restoreState of some other instance of UIComponentBase to reset that object's state to the same values as this object currently has.- Specified by:
- saveStatein interface- StateHolder
- Overrides:
- saveStatein class- UIComponentBase
 
 - 
restoreStatepublic void restoreState(FacesContext facesContext, Object state) Description copied from class:UIComponentBaseInvoked in the "restore view" phase, this initialises this object's members from the values saved previously into the provided state object.- Specified by:
- restoreStatein interface- StateHolder
- Overrides:
- restoreStatein class- UIComponentBase
- state- is an object previously returned by the saveState method of this class.
 
 - 
restoreViewScopeStatepublic void restoreViewScopeState(FacesContext facesContext, Object state) - Parameters:
- facesContext-
- state-
- Since:
- 2.2
 
 - 
getViewListenersForEventClasspublic List<SystemEventListener> getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent) 
 - 
subscribeToViewEventpublic void subscribeToViewEvent(Class<? extends SystemEvent> systemEvent, SystemEventListener listener) 
 - 
unsubscribeFromViewEventpublic void unsubscribeFromViewEvent(Class<? extends SystemEvent> systemEvent, SystemEventListener listener) 
 - 
getDoctypepublic Doctype getDoctype() Return the doctype of this view. - Returns:
- the doctype of this view.
- Since:
- 4.0
 
 - 
setDoctypepublic void setDoctype(Doctype doctype) Set the doctype of this view. - Parameters:
- doctype- The doctype.
- Since:
- 4.0
 
 
- 
 
-