×
☰ See All Chapters

JSF inputText inputSecret inputTextarea

Example

Output

Description

<h:inputText value="#{loginBean.testString}" readonly="true" />

 

Input is read-only

<h:inputText value="ABCDEFG" size="5" />

 

size attribute is the number of characters used to determine the width of this field. The size attribute specifies the number of visible characters in a text field.

<h:inputText value="1234567890" maxlength="6" size="10" />

 

maxlength attribute decides the maximum number of characters that may be entered in this field.

<h:inputSecret value="#{loginBean.password}" redisplay="true" />

 

 

Password is shown after an unsuccessful form submit. If redisplay="false" then filed is displayed empty after an unsuccessful form submit.

If redisplay="true", the text field stores its value between requests and, therefore, the value is redisplayed when the page reloads. If redisplay is false, the value is discarded and is not redisplayed.

<h:inputText value="inputText" style="color: red; background: yellow;" />

 

Applying style to inputText

<h:inputSecret value="#{loginBean.password}" redisplay="false" />

 

 

Password is not shown after an unsuccessful form submit.

<h:inputTextarea rows="6" />

 

rows attributes defines the number of rows to be displayed.

<h:inputTextarea cols="6" />

 

cols attribute defines the number of columns to be displayed.

<h:inputTextarea value="ABCDEFGHIJKLM" rows="4" cols="8" />

 

The current value of this component is ABCDEFGHIJKLM

<h:inputTextarea value="#{loginBean.details}" rows="3" cols="10" />

 

 

value is bound to managed bean property

 


All Chapters
Author