JSF 2 InputText Example


In this example, we will see how to add an input text in a JSF page using the <h:inputText ../>  tag.


1. Project structure



2. JSF pages

We will add an inputText and link it to the name attribute of user bean.

File : index.xhtml

The <h:inputText ..> will render an HTML input element of type text.

In the welcome page, we will display the inputText value submitted from the index page.

File : welcome.xhtml


3. Managed bean



4. Test It

We enter a name in the inputText and press the button.





Download source code