The behavior of the <h:inputHidden>
is the same as for a <h:inputText>
component for example:
<h:inputHidden id="myHiddenField" value="#{myBean.myValue}"/>
will refer to the property myValue
of the bean myBean
. So you will have to provide both getMyValue()
and setMyValue(String)
in this bean.
So if you change the value of this hidden field on the client side (using Javascript), then the new value will be updated on the bean side once the form is submitted.
Regarding the ID, you must specify the id
attribute, otherwise JSF will generate one for you (something like j_id123
for example). If you specify a value for this attribute, the ID of the HTML tag will be the one you specified, prefixed by your form ID. So in the following example:
<h:form id="myForm">
<h:inputHidden id="myField" .../>
the HTML <input>
tag will have the id myForm:myField
(note the :
used as a separator of ids).