Top Description Inners Fields Constructors Methods
jakarta.faces.component

public Class UIViewParameter

extends UIInput
Class Inheritance
Imports
java.io.IOException, java.util.Iterator, jakarta.el.ValueExpression, jakarta.faces.FactoryFinder, jakarta.faces.application.FacesMessage, jakarta.faces.context.FacesContext, jakarta.faces.convert.Converter, .ConverterException, jakarta.faces.render.RenderKit, .RenderKitFactory, .Renderer, jakarta.faces.validator.RequiredValidator, .Validator

UIViewParameter represents a binding between a request parameter and a model property or UIViewRoot property. This is a bi-directional binding.

The jakarta.faces.view.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 and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum
public static class
UIViewParameter.Reference

Inner class to encapsulate a UIViewParameter instance so that it may be safely referenced regardless of whether or not the current view is the same as the view in which this UIViewParameter resides.

Field Summary

Modifier and TypeField and Description
public static final String
COMPONENT_FAMILY

Hides jakarta.faces.component.UIInput.COMPONENT_FAMILY.

The standard component family for this component.

public static final String
COMPONENT_TYPE

Hides jakarta.faces.component.UIInput.COMPONENT_TYPE.

The standard component type for this component.

private transient Boolean
private Renderer<T extends UIComponent>
private String
rawValue

The raw value is the "implicit" binding for this view parameter.

Inherited from jakarta.faces.component.UIInput:
ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUECONVERSION_MESSAGE_IDEMPTY_STRING_AS_NULL_PARAM_NAMEREQUIRED_MESSAGE_IDUPDATE_MESSAGE_IDVALIDATE_EMPTY_FIELDS_PARAM_NAMEvalidators

Constructor Summary

AccessConstructor and Description
public
UIViewParameter()

Create a new UIViewParameter instance with default property values.

Method Summary

Modifier and TypeMethod and Description
public void
decode(FacesContext
FacesContext for the request we are processing
context
)

Overrides jakarta.faces.component.UIInput.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 to UIInput#setSubmittedValue.

public void
encodeAll(FacesContext
the Faces context.
context
)

Overrides jakarta.faces.component.UIComponent.encodeAll.

Called specially by UIViewRoot#encodeEnd, this method simply sets the submitted value to be the return from getStringValue.

protected Object

Returns:

the converted value.
getConvertedValue
(FacesContext
the Faces context.
context
,
Object
the submitted value.
submittedValue
)

Overrides jakarta.faces.component.UIInput.getConvertedValue.

Because this class has no Renderer, leverage the one from the standard HTML_BASIC RenderKit with component-family: jakarta.faces.Input and renderer-type: jakarta.faces.Text and call its Renderer#getConvertedValue method.

public String
getFamily()

Overrides jakarta.faces.component.UIInput.getFamily.

Return the identifier of the component family to which this component belongs.

private Renderer<T extends UIComponent>
public String

Returns:

the name.
getName
()

Return the request parameter name from which the value is retrieved.

public String

Returns:

the string value.
getStringValue
(FacesContext
the Faces context.
context
)

If the value of this parameter comes from a ValueExpression return the value of the expression, otherwise, return the local value.

public String

Returns:

the string value from the model.
getStringValueFromModel
(FacesContext
the Faces context.
context
)

Manually perform standard conversion steps to get a string value from the value expression.

public Object

Returns:

the submitted value.
getSubmittedValue
()

Overrides jakarta.faces.component.UIInput.getSubmittedValue.

Implements jakarta.faces.component.EditableValueHolder.getSubmittedValue.

Assume that the submitted value is always a string, but the return type from this method is Object.

private boolean
public boolean

Returns:

true if immediate, false otherwise.
isImmediate
()

Overrides jakarta.faces.component.UIInput.isImmediate.

Implements jakarta.faces.component.EditableValueHolder.isImmediate.

Return false.

private boolean
private boolean
public void
processValidators(FacesContext
the Faces context.
context
)

Overrides jakarta.faces.component.UIInput.processValidators.

Specialize superclass behavior to treat null differently.

public void
setName(String
The new request parameter name.
name
)

Set the request parameter name from which the value is retrieved.

public void
setSubmittedValue(Object
The new submitted value
submittedValue
)

Overrides jakarta.faces.component.UIInput.setSubmittedValue.

Implements jakarta.faces.component.EditableValueHolder.setSubmittedValue.

PENDING (docs) Interesting that submitted value isn't saved by the parent
public void
updateModel(FacesContext
FacesContext for the request we are processing
context
)

Overrides jakarta.faces.component.UIInput.updateModel.

Call through to superclass UIInput#updateModel 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.

Inherited from jakarta.faces.component.UIInput:
addValidatoraddValueChangeListenerclearInitialStatecompareValuesconsiderEmptyStringNullgetConverterMessagegetRequiredMessagegetValidatorMessagegetValidatorsgetValuegetValueChangeListenersisEmptyisLocalValueSetisRequiredisValidmarkInitialStateprocessDecodesprocessUpdatesremoveValidatorremoveValueChangeListenerresetValuerestoreStatesaveStatesetConverterMessagesetImmediatesetLocalValueSetsetRequiredsetRequiredMessagesetValidsetValidatorMessagesetValuevalidatevalidateValue

Field Detail

COMPONENT_FAMILYback to summary
public static final String COMPONENT_FAMILY

Hides jakarta.faces.component.UIInput.COMPONENT_FAMILY.

The standard component family for this component.

COMPONENT_TYPEback to summary
public static final String COMPONENT_TYPE

Hides jakarta.faces.component.UIInput.COMPONENT_TYPE.

The standard component type for this component.

emptyStringIsNullback to summary
private transient Boolean emptyStringIsNull

Hides jakarta.faces.component.UIInput.emptyStringIsNull.

inputTextRendererback to summary
private Renderer<T extends UIComponent> inputTextRenderer
rawValueback to summary
private String rawValue

The raw value is the "implicit" binding for this view parameter. This property maintains the submitted value of the view parameter for the duration of the request. If the view parameter does not explicitly specify a value expression, then when the request ends, this value is stored with the state of this component to use as the submitted value on an ensuing postback.

Constructor Detail

UIViewParameterback to summary
public UIViewParameter()

Create a new UIViewParameter instance with default property values.

Method Detail

decodeback to summary
public void decode(FacesContext context)

Overrides jakarta.faces.component.UIInput.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 to UIInput#setSubmittedValue.

Parameters
context:FacesContext

Doc from jakarta.faces.component.UIComponent.decode.

FacesContext for the request we are processing

Annotations
@Override
Since
2.0
encodeAllback to summary
public void encodeAll(FacesContext context) throws IOException

Overrides jakarta.faces.component.UIComponent.encodeAll.

Called specially by UIViewRoot#encodeEnd, this method simply sets the submitted value to be the return from getStringValue.

Parameters
context:FacesContext

Doc from jakarta.faces.component.UIComponent.encodeAll.

the Faces context.

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs.
Since
2.0
getConvertedValueback to summary
protected Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException

Overrides jakarta.faces.component.UIInput.getConvertedValue.

Because this class has no Renderer, leverage the one from the standard HTML_BASIC RenderKit with component-family: jakarta.faces.Input and renderer-type: jakarta.faces.Text and call its Renderer#getConvertedValue method.

Parameters
context:FacesContext

Doc from jakarta.faces.component.UIInput.getConvertedValue.

the Faces context.

submittedValue:Object

the submitted value.

Returns:Object

the converted value.

Annotations
@Override
Since
2.0
getFamilyback to summary
public String getFamily()

Overrides jakarta.faces.component.UIInput.getFamily.

Doc from jakarta.faces.component.UIComponent.getFamily.

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 appropriate Renderer for this component instance. Note this method should NOT return null

Returns:String

the component family (not null).

Annotations
@Override
getInputTextRendererback to summary
private Renderer<T extends UIComponent> getInputTextRenderer(FacesContext context)
getNameback to summary
public String getName()

Return the request parameter name from which the value is retrieved.

Returns:String

the name.

Since
2.0
getStringValueback to summary
public String getStringValue(FacesContext context)

If the value of this parameter comes from a ValueExpression return the value of the expression, otherwise, return the local value.

Parameters
context:FacesContext

the Faces context.

Returns:String

the string value.

Since
2.0
getStringValueFromModelback to summary
public String getStringValueFromModel(FacesContext context) throws ConverterException

Manually perform standard conversion steps to get a string value from the value expression.

Parameters
context:FacesContext

the Faces context.

Returns:String

the string value from the model.

Since
2.0
getSubmittedValueback to summary
public Object getSubmittedValue()

Overrides jakarta.faces.component.UIInput.getSubmittedValue.

Implements jakarta.faces.component.EditableValueHolder.getSubmittedValue.

Assume that the submitted value is always a string, but the return type from this method is Object..

Returns:Object

the submitted value.

Annotations
@Override
Since
2.0
hasValueExpressionback to summary
private boolean hasValueExpression()
isImmediateback to summary
public boolean isImmediate()

Overrides jakarta.faces.component.UIInput.isImmediate.

Implements jakarta.faces.component.EditableValueHolder.isImmediate.

Return false. The immediate setting is not relevant for view parameters and must be assumed to be false.

Returns:boolean

true if immediate, false otherwise.

Annotations
@Override
Since
2.0
isRequiredViaNestedRequiredValidatorback to summary
private boolean isRequiredViaNestedRequiredValidator()
myIsRequiredback to summary
private boolean myIsRequired()
processValidatorsback to summary
public void processValidators(FacesContext context)

Overrides jakarta.faces.component.UIInput.processValidators.

Specialize superclass behavior to treat null differently. In this class, a null value along with the "required" flag being set to true will cause a validation failure. Otherwise, If the UIInput#EMPTY_STRING_AS_NULL_PARAM_NAME context parameter is true and the value is null, call UIInput#setSubmittedValue passing the empty string as the argument. This will cause the normal validation processing to happen, including bean validation.

Parameters
context:FacesContext

the Faces context.

Annotations
@Override
Since
2.0
setNameback to summary
public void setName(String name)

Set the request parameter name from which the value is retrieved.

Parameters
name:String

The new request parameter name.

Since
2.0
setSubmittedValueback to summary
public void setSubmittedValue(Object submittedValue)

Overrides jakarta.faces.component.UIInput.setSubmittedValue.

Implements jakarta.faces.component.EditableValueHolder.setSubmittedValue.

PENDING (docs) Interesting that submitted value isn't saved by the parent

Parameters
submittedValue:Object

The new submitted value

Annotations
@Override
updateModelback to summary
public void updateModel(FacesContext context)

Overrides jakarta.faces.component.UIInput.updateModel.

Call through to superclass UIInput#updateModel 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.

Parameters
context:FacesContext

Doc from jakarta.faces.component.UIInput.updateModel.

FacesContext for the request we are processing

Annotations
@Override
Since
2.0
jakarta.faces.component back to summary

pack-priv final Enum UIViewParameter.PropertyKeys

extends Enum<UIViewParameter.PropertyKeys>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final UIViewParameter.PropertyKeys
public static final UIViewParameter.PropertyKeys

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static UIViewParameter.PropertyKeys
public static UIViewParameter.PropertyKeys[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

nameback to summary
public static final UIViewParameter.PropertyKeys name

Hides java.lang.Enum.name.

submittedValueback to summary
public static final UIViewParameter.PropertyKeys submittedValue

Constructor Detail

PropertyKeysback to summary
private PropertyKeys()

Method Detail

valueOfback to summary
public static UIViewParameter.PropertyKeys valueOf(String name)
valuesback to summary
public static UIViewParameter.PropertyKeys[] values()
jakarta.faces.component back to summary

public Class UIViewParameter.Reference

extends Object
Class Inheritance

Inner class to encapsulate a UIViewParameter instance so that it may be safely referenced regardless of whether or not the current view is the same as the view in which this UIViewParameter resides.

Since
2.0

Field Summary

Modifier and TypeField and Description
private int
private StateHolderSaver
private String

Constructor Summary

AccessConstructor and Description
public
Reference(FacesContext
the FacesContextfor this request
context
,
UIViewParameter
the UIViewParameter.
param
,
int
the index of the UIViewParameter in its parent UIPanel.
indexInParent
,
String
the viewId of the view in which the UIViewParameter is included. This may not be the same as the viewId from the context argument.
viewIdAtTimeOfConstruction
)

Construct a reference to a UIViewParameter.

Method Summary

Modifier and TypeMethod and Description
public UIViewParameter

Returns:

the UIViewParameter.
getUIViewParameter
(FacesContext
the FacesContextfor this request
context
)

Return the UIViewParameter to which this instance refers.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexInParentback to summary
private int indexInParent
saverback to summary
private StateHolderSaver saver
viewIdAtTimeOfConstructionback to summary
private String viewIdAtTimeOfConstruction

Constructor Detail

Referenceback to summary
public Reference(FacesContext context, UIViewParameter param, int indexInParent, String viewIdAtTimeOfConstruction)

Construct a reference to a UIViewParameter. This constructor cause the StateHolder#saveState method to be called on argument UIViewParameter.

Parameters
context:FacesContext

the FacesContextfor this request

param:UIViewParameter

the UIViewParameter.

indexInParent:int

the index of the UIViewParameter in its parent UIPanel.

viewIdAtTimeOfConstruction:String

the viewId of the view in which the UIViewParameter is included. This may not be the same as the viewId from the context argument.

Since
2.0

Method Detail

getUIViewParameterback to summary
public UIViewParameter getUIViewParameter(FacesContext context)

Return the UIViewParameter to which this instance refers. If the current viewId is the same as the viewId passed to our constructor, use the index passed to the constructor to find the actual UIViewParameter instance and return it. Otherwise, call StateHolder#restoreState on the saved state and return the result.

Parameters
context:FacesContext

the FacesContextfor this request

Returns:UIViewParameter

the UIViewParameter.

Since
2.0