Class UIOutput
- java.lang.Object
-
- jakarta.faces.component.UIComponent
-
- jakarta.faces.component.UIComponentBase
-
- jakarta.faces.component.UIOutput
-
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,TransientStateHolder
,ValueHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
- Direct Known Subclasses:
HtmlBody
,HtmlDoctype
,HtmlHead
,HtmlOutputFormat
,HtmlOutputLabel
,HtmlOutputLink
,HtmlOutputText
,UIInput
,UIOutcomeTarget
public class UIOutput extends UIComponentBase implements ValueHolder
UIOutput is a
UIComponent
that has a value, optionally retrieved from a model tier bean via a value expression, that is displayed to the user. The user cannot directly modify the rendered value; it is for display purposes only.During the Render Response phase of the request processing lifecycle, the current value of this component must be converted to a String (if it is not already), according to the following rules:
- If the current value is not
null
, and is not already aString
, locate aConverter
(if any) to use for the conversion, as follows: - If the current value is not
null
and aConverter
was located, call itsgetAsString()
method to perform the conversion. - If the current value is not
null
but noConverter
was located, calltoString()
on the current value to perform the conversion.
By default, the
rendererType
property must be set to "jakarta.faces.Text
". This value can be changed by calling thesetRendererType()
method.
-
-
Field Summary
Fields Modifier and Type Field Description static String
COMPONENT_FAMILY
The standard component family for this component.static String
COMPONENT_TYPE
The standard component type for this component.-
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearInitialState()
For each of the attached objects on this instance that implementPartialStateHolder
, callPartialStateHolder.clearInitialState()
on the attached object.Converter
getConverter()
Return theConverter
(if any) that is registered for thisUIComponent
.String
getFamily()
Return the identifier of the component family to which this component belongs.Object
getLocalValue()
Return the local value of thisUIComponent
(if any), without evaluating any associatedValueExpression
.Object
getValue()
Return the value property.void
markInitialState()
In addition to the actions taken inUIComponentBase
whenPartialStateHolder.markInitialState()
is called, check if the installedConverter
is a PartialStateHolder and if it is, callPartialStateHolder.markInitialState()
on it.void
resetValue()
Convenience method to reset this component's value to the un-initialized state.void
restoreState(FacesContext context, Object state)
Perform any processing required to restore the state from the entries in the state Object.Object
saveState(FacesContext context)
Gets the state of the instance as aSerializable
Object.void
setConverter(Converter converter)
Set theConverter
(if any) that is registered for thisUIComponent
.void
setValue(Object value)
Set the value of thisUIComponent
(if any).-
Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, invokeOnComponent, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, subscribeToEvent, unsubscribeFromEvent
-
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
-
-
-
-
Field Detail
-
COMPONENT_TYPE
public static final String COMPONENT_TYPE
The standard component type for this component.
- See Also:
- Constant Field Values
-
COMPONENT_FAMILY
public static final String COMPONENT_FAMILY
The standard component family for this component.
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UIOutput
public UIOutput()
Create a new
UIOutput
instance with default property values.
-
-
Method Detail
-
getFamily
public String getFamily()
Description copied from class:UIComponent
Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererType
property, may be used to select the appropriateRenderer
for this component instance. Note this method should NOT returnnull
- Specified by:
getFamily
in classUIComponent
- Returns:
- the component family (not null).
-
getConverter
public Converter getConverter()
Description copied from interface:ValueHolder
Return the
Converter
(if any) that is registered for thisUIComponent
.- Specified by:
getConverter
in interfaceValueHolder
- Returns:
- the converter.
-
setConverter
public void setConverter(Converter converter)
Description copied from interface:ValueHolder
Set the
Converter
(if any) that is registered for thisUIComponent
.- Specified by:
setConverter
in interfaceValueHolder
- Parameters:
converter
- NewConverter
(ornull
)
-
getLocalValue
public Object getLocalValue()
Description copied from interface:ValueHolder
Return the local value of this
UIComponent
(if any), without evaluating any associatedValueExpression
.- Specified by:
getLocalValue
in interfaceValueHolder
- Returns:
- the local value.
-
getValue
public Object getValue()
Return the value property.
- Specified by:
getValue
in interfaceValueHolder
- Returns:
- the value.
- Since:
- 2.2
-
setValue
public void setValue(Object value)
Description copied from interface:ValueHolder
Set the value of this
UIComponent
(if any).- Specified by:
setValue
in interfaceValueHolder
- Parameters:
value
- The new local value
-
resetValue
public void resetValue()
Convenience method to reset this component's value to the un-initialized state.
- Since:
- 2.2
-
markInitialState
public void markInitialState()
In addition to the actions taken in
UIComponentBase
whenPartialStateHolder.markInitialState()
is called, check if the installedConverter
is a PartialStateHolder and if it is, callPartialStateHolder.markInitialState()
on it.- Specified by:
markInitialState
in interfacePartialStateHolder
- Overrides:
markInitialState
in classUIComponentBase
-
clearInitialState
public void clearInitialState()
Description copied from class:UIComponentBase
For each of the attached objects on this instance that implement
PartialStateHolder
, callPartialStateHolder.clearInitialState()
on the attached object.- Specified by:
clearInitialState
in interfacePartialStateHolder
- Overrides:
clearInitialState
in classUIComponentBase
-
saveState
public Object saveState(FacesContext context)
Description copied from interface:StateHolder
Gets the state of the instance as a
Serializable
Object.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.saveState(jakarta.faces.context.FacesContext)
method on all those instances as well. This method must not save the state of children and facets. That is done via theStateManager
This method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
component
should be the same as before executing it.The return from this method must be
Serializable
- Specified by:
saveState
in interfaceStateHolder
- Overrides:
saveState
in classUIComponentBase
- Parameters:
context
- the Faces context.- Returns:
- the saved state.
-
restoreState
public void restoreState(FacesContext context, Object state)
Description copied from interface:StateHolder
Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.restoreState(jakarta.faces.context.FacesContext, java.lang.Object)
method on all those instances as well.If the
state
argument isnull
, take no action and return.- Specified by:
restoreState
in interfaceStateHolder
- Overrides:
restoreState
in classUIComponentBase
- Parameters:
context
- the Faces context.state
- the state.
-
-