The <o:inputHidden> is a component that extends the standard <h:inputHidden>
and changes the behavior to immediately convert, validate and update during apply request values phase, regardless of
any conversion/validation errors on other UIInput components within the same form. The standard
<h:inputHidden> follows the same lifecycle as other UIInput components which is in
the end unintuive as hidden input fields are usually under control of the developer.
Use case 1: Imagine a form with a <h:inputHidden> and a <h:inputText>. The
hidden input holds some prepopulated value of a request scoped bean which is intended to be passed through to the
request scoped bean instance of the next request. However, when conversion/validation fails on the text input, then
the hidden input won't update the bean property and then becomes empty. I.e. the original value gets permanently lost.
This can be bypassed by using ajax to update only specific fields, but this will fail when the update of the hidden
input is actually needed (e.g. because the value can possibly be adjusted in action/listener method).
Use case 2: Imagine a form with an UIInput or UICommand component whose
rendered attribute relies on a request scoped bean property which is retained for the next request
through a <h:inputHidden>. However, when Faces needs to decode the UIInput or
UICommand component during the postback, the rendered attribute has defaulted back to
false because the <h:inputHidden> hasn't yet updated the request scoped bean property
yet.
This behavior cannot be achieved by using immediate="true" on <h:inputHidden>. It
would only move the conversion/validation into the apply request values phase. The model still won't be updated on
time.
Also, the <h:inputHidden> didn't support the readonly attribute. This is however
useful when used in combination with a validator which should block the form submit. Since version 4.1, the
<o:inputHidden> supports this use case by simply grabbing and validating the model value during
the apply request values phase. The setter method associated with the model won't be invoked.
You can use it the same way as <h:inputHidden>, you only need to change h: into
o: to get the "immediate v2.0" behavior.
<h:form>
<o:inputHidden value="#{bean.hidden}" />
...
</h:form>
When using ajax, don't forget to make sure that the component is also covered by the execute attribute.
| Info | Value |
|---|---|
| Component Type | org.omnifaces.component.input.InputHidden |
| 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. |
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. |
immediate | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating that this component's value must be converted and validated immediately (that is, during Apply Request Values phase), rather than waiting until Process Validations phase. |
readonly | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Whether this component is readonly. Defaults to false. When set to true, the
submitted value will be ignored and the model value will be used as submitted value. All associated validators
will still be invoked based on the model value, not on the submitted value. Also the setter won't be invoked. |
rendered | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true. |
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. |
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)
| The current value of this component. |
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. |
Output generated by Vdldoc View Declaration Language Documentation Generator.