Class UIViewParameter
- All Implemented Interfaces:
EditableValueHolder,PartialStateHolder,StateHolder,TransientStateHolder,ValueHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener
UIViewParameter represents a binding between a
request parameter and a model property or UIViewRoot property. This is a bi-directional binding.
The ViewDeclarationLanguage implementation must cause an instance of this component to
appear in the view for each occurrence of an <f:viewParam /> element placed inside of an
<f:metadata /> element. The user must place this facet within the UIViewRoot.
Because this class extends UIInput any actions that one would normally take on a UIInput
instance are valid for instances of this class. Instances of this class participate in the regular Jakarta Server
Faces lifecycle, including on Ajax requests.
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class to encapsulate aUIViewParameterinstance so that it may be safely referenced regardless of whether or not the current view is the same as the view in which thisUIViewParameterresides. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe standard component family for this component.static final StringThe standard component type for this component.Fields inherited from class jakarta.faces.component.UIInput
ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUE, CONVERSION_MESSAGE_ID, EMPTY_STRING_AS_NULL_PARAM_NAME, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAMEFields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(FacesContext context) Override behavior from superclass to pull a value from the incoming request parameter map under the name given bygetName()and store it with a call toUIInput.setSubmittedValue(java.lang.Object).voidencodeAll(FacesContext context) Called specially byUIViewRoot.encodeEnd(jakarta.faces.context.FacesContext), this method simply sets the submitted value to be the return fromgetStringValue(jakarta.faces.context.FacesContext).protected ObjectgetConvertedValue(FacesContext context, Object submittedValue) Because this class has noRenderer, leverage the one from the standard HTML_BASICRenderKitwithcomponent-family: jakarta.faces.Inputandrenderer-type: jakarta.faces.Textand call itsRenderer.getConvertedValue(jakarta.faces.context.FacesContext, T, java.lang.Object)method.Return the identifier of the component family to which this component belongs.getName()Return the request parameter name from which the value is retrieved.getStringValue(FacesContext context) If the value of this parameter comes from aValueExpressionreturn the value of the expression, otherwise, return the local value.getStringValueFromModel(FacesContext context) Manually perform standard conversion steps to get a string value from the value expression.Assume that the submitted value is always a string, but the return type from this method isObject..booleanReturnfalse.voidprocessValidators(FacesContext context) Specialize superclass behavior to treatnulldifferently.voidSet the request parameter name from which the value is retrieved.voidsetSubmittedValue(Object submittedValue) PENDING (docs) Interesting that submitted value isn't saved by the parentvoidupdateModel(FacesContext context) Call through to superclassUIInput.updateModel(jakarta.faces.context.FacesContext)then take the additional action of pushing the value into request scope if and only if the value is not a value expression, is valid, and the local value was set on this lifecycle execution.Methods inherited from class jakarta.faces.component.UIInput
addValidator, addValueChangeListener, clearInitialState, compareValues, getConverterMessage, getRequiredMessage, getValidatorMessage, getValidators, getValue, getValueChangeListeners, isEmpty, isLocalValueSet, isRequired, isValid, markInitialState, processDecodes, processUpdates, removeValidator, removeValueChangeListener, resetValue, restoreState, saveState, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setValid, setValidatorMessage, setValue, validate, validateValueMethods inherited from class jakarta.faces.component.UIOutput
getConverter, getLocalValue, setConverterMethods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, 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, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, subscribeToEvent, unsubscribeFromEventMethods inherited from class jakarta.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTreeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.faces.component.ValueHolder
getConverter, getLocalValue, setConverter
-
Field Details
-
COMPONENT_TYPE
The standard component type for this component.
- See Also:
-
COMPONENT_FAMILY
The standard component family for this component.
- See Also:
-
-
Constructor Details
-
UIViewParameter
public UIViewParameter()Create a new
UIViewParameterinstance with default property values.
-
-
Method Details
-
getFamily
Description copied from class:UIComponentReturn the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererTypeproperty, may be used to select the appropriateRendererfor this component instance. Note this method should NOT returnnull -
getName
Return the request parameter name from which the value is retrieved.
- Returns:
- the name.
- Since:
- 2.0
-
setName
Set the request parameter name from which the value is retrieved.
- Parameters:
name- The new request parameter name.- Since:
- 2.0
-
isImmediate
public boolean isImmediate()Return
false. The immediate setting is not relevant for view parameters and must be assumed to befalse.- Specified by:
isImmediatein interfaceEditableValueHolder- Overrides:
isImmediatein classUIInput- Returns:
trueif immediate,falseotherwise.- Since:
- 2.0
-
getSubmittedValue
Assume that the submitted value is always a string, but the return type from this method is
Object..- Specified by:
getSubmittedValuein interfaceEditableValueHolder- Overrides:
getSubmittedValuein classUIInput- Returns:
- the submitted value.
- Since:
- 2.0
-
setSubmittedValue
PENDING (docs) Interesting that submitted value isn't saved by the parent- Specified by:
setSubmittedValuein interfaceEditableValueHolder- Overrides:
setSubmittedValuein classUIInput- Parameters:
submittedValue- The new submitted value
-
decode
Override behavior from superclass to pull a value from the incoming request parameter map under the name given by
getName()and store it with a call toUIInput.setSubmittedValue(java.lang.Object).- Overrides:
decodein classUIInput- Parameters:
context-FacesContextfor the request we are processing- Since:
- 2.0
-
processValidators
Specialize superclass behavior to treat
nulldifferently. In this class, anullvalue along with the "required" flag being set totruewill cause a validation failure. Otherwise, If theUIInput.EMPTY_STRING_AS_NULL_PARAM_NAMEcontext parameter is true and the value isnull, callUIInput.setSubmittedValue(java.lang.Object)passing the empty string as the argument. This will cause the normal validation processing to happen, including bean validation.- Overrides:
processValidatorsin classUIInput- Parameters:
context- the Faces context.- Since:
- 2.0
- See Also:
-
updateModel
Call through to superclass
UIInput.updateModel(jakarta.faces.context.FacesContext)then take the additional action of pushing the value into request scope if and only if the value is not a value expression, is valid, and the local value was set on this lifecycle execution.- Overrides:
updateModelin classUIInput- Parameters:
context-FacesContextfor the request we are processing- Since:
- 2.0
-
encodeAll
Called specially by
UIViewRoot.encodeEnd(jakarta.faces.context.FacesContext), this method simply sets the submitted value to be the return fromgetStringValue(jakarta.faces.context.FacesContext).- Overrides:
encodeAllin classUIComponent- Parameters:
context- the Faces context.- Throws:
IOException- when an I/O error occurs.- Since:
- 2.0
-
getStringValue
If the value of this parameter comes from a
ValueExpressionreturn the value of the expression, otherwise, return the local value.- Parameters:
context- the Faces context.- Returns:
- the string value.
- Since:
- 2.0
-
getStringValueFromModel
Manually perform standard conversion steps to get a string value from the value expression.
- Parameters:
context- the Faces context.- Returns:
- the string value from the model.
- Throws:
ConverterException- Since:
- 2.0
-
getConvertedValue
protected Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException Because this class has no
Renderer, leverage the one from the standard HTML_BASICRenderKitwithcomponent-family: jakarta.faces.Inputandrenderer-type: jakarta.faces.Textand call itsRenderer.getConvertedValue(jakarta.faces.context.FacesContext, T, java.lang.Object)method.- Overrides:
getConvertedValuein classUIInput- Parameters:
context- the Faces context.submittedValue- the submitted value.- Returns:
- the converted value.
- Throws:
ConverterException- Since:
- 2.0
-