UIViewParameter
and provides a
stateless mode of operation and fixes the issue wherein null model values are converted to empty string parameters
in query string (e.g. when includeViewParams=true
) and the (bean) validation never being triggered
when the parameter is completely absent in query string, causing e.g. @NotNull
to fail.
The standard UIViewParameter implementation calls the model setter again after postback. This is not always desired when being bound to a view scoped bean and can lead to performance problems when combined with an expensive converter. To solve this, this component by default stores the submitted value as a component property instead of in the model (and thus in the view state in case the binding is to a view scoped bean).
The standard UIViewParameter implementation calls the converter regardless of whether the evaluated model value is
null
or not. As converters by specification return an empty string in case of null
value,
this is being added to the query string as an empty parameter. This is not desired.
The standard UIViewParameter implementation uses an internal "is required" check when the submitted value is
null
, hereby completely bypassing the standard UIInput
validation, including any bean
validation annotations and even the PreValidateEvent
and PostValidateEvent
events. This is not
desired.
You can use it the same way as <f:viewParam>
, you only need to change f:
to
o:
.
Info | Value |
---|---|
Component Type | org.omnifaces.component.input.ViewParam |
Handler Class | None |
Renderer Type | None |
Description | None |
Name | Required | Type | Description |
---|---|---|---|
binding | false | jakarta.el.ValueExpression
(must evaluate to jakarta.faces.component.UIComponent )
| The ValueExpression linking this component to a property in a backing bean |
converter | false | jakarta.el.ValueExpression
(must evaluate to jakarta.faces.convert.Converter )
| Converter instance registered with this component. |
converterMessage | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| A ValueExpression enabled attribute that, if present, will be used as the text of the converter message, replacing any message that comes from the converter. |
default | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
|
The default value to be used when actual value of the request parameter is null or empty.
|
id | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
maxlength | false | jakarta.el.ValueExpression
(must evaluate to int )
| The maximum number of characters that may be entered in this field. |
name | true | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| The name of the request parameter from which the value for this component is retrieved on an initial request or to override the stored value on a postback. |
required | false | jakarta.el.ValueExpression
(must evaluate to boolean )
| Flag indicating that the user is required to provide a submitted value for this input component. This component extends the behavior of this by only making this required for a non-faces request. |
requiredMessage | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| A ValueExpression enabled attribute that, if present, will be used as the text of the validation message for the "required" facility, if the "required" facility is used. |
validator | false | jakarta.el.MethodExpression
(signature must match void validate(jakarta.faces.context.FacesContext,
jakarta.faces.component.UIComponent, java.lang.Object)
)
| MethodExpression representing a validator method that will be called during Process Validations to perform correctness checks on the value of this component. The expression must evaluate to a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void. |
validatorMessage | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String )
| A ValueExpression enabled attribute that, if present, will be used as the text of the validator message, replacing any message that comes from the validator. |
value | false | jakarta.el.ValueExpression
(must evaluate to java.lang.Object )
| A ValueExpression to which the value of the request parameter, as determined by the name attribute, is bound. The resolved value of this expression is used when encoding the view parameter into a bookmarkable link or redirect URL with view parameter encoding enabled. If this attribute is omitted, the value of the request parameter will instead be the local value of the UIViewParameter. |
valueChangeListener | false | jakarta.el.MethodExpression
(signature must match void
valueChange(jakarta.faces.event.ValueChangeEvent)
)
|
MethodExpression representing a value change listener method
that will be notified when a new value has been set for this
input component. The expression must evaluate to a public
method that takes a ValueChangeEvent
parameter,
with a return type of void, or
to a public method that takes no arguments with a return type
of void. In the latter case, the method has no way of easily
knowing what the new value is, but this can be useful in cases
where a notification is needed that "this value
changed".
|
Output generated by Vdldoc View Declaration Language Documentation Generator.