The JSF <h: inputText> tag is used to render an input field on the web page.
It is used within a <h: form> tag to declare input field that allows user to input data.
The value attribute refers to the name property of a managed bean named User. This property holds the data for the name component. After the user submits the form, the value of the name property in User will be set to the text entered in the field corresponding to this tag.
JSF <h:InputText> Tag Example:
In the following example, we are using a label tag for providing label to inputText tag, a inputText with attributes, a commandButton to represent a submit button. All are enclosed in a <h:form> tag.
JSF renders <h:inputText> tag as below:
JSF <h:inputText> Tag Attributes
||It is an identifier for this component. This id must be unique. You can use it to access HTML element in CSS and JS file.
||It is used to collect present value of the inputText.
||It gives class name to the component. It is used to access component from CSS and JS file.
||The maximum number of characters that may be entered in this field.
||Alternate textual description of the element rendered by this component.
||Access key that, when pressed, transfers focus to this element. It varies browser to browser.
||The number of characters used to determine the width of this field .
||It indicates that the user is required to provide a submitted value for this input component.
||If required attribute is set to true, the message description provided in the requiredMessage is display to the web page.
||It is used to apply CSS for the component.
||It is used to render the component. The default value for this property is true.
||It is used to converter instance registered with this component.
||It indicates that this component prohibits changes by the user. You can make component readonly by passing readonly as a value of this attribute.
eg. readonly = "readonly"