Learn JSF – inputText Tag


Hi, Welcome to the practice house.

The h:inputText tag represents HTML “text” type of input element. We use h:inputText in JSF to use as a form element like how we use input type text in our HTML.


h:inputText will render as like this in HTML input type "text"

okay, let’s create a JSF application to check how it works.

Creating JSF Web Application

So to create a sample JSF web Application please follow this article :

How To Create A Java Server Faces (JSF) Web Application

When you are done creating the project please follow the Next Step as described below.

Project Folder Structure

004 - JSF inputText Application Project Structure

So this is how our project folder will look like. In our project,

  • index.xhtml to represent the h:inputText Tag.
  • We will use a ManagedBean Student.java
  • response.xhtml  the file we will use to display our output.




Sample Output Of h:inputText Tag in JSF Application

Run your application and you will see the index.xhtml page like this. I have key in my name "Arifur Rahman" as an input.

002 - index file for JSF inputText

After clicking the Submit button it will display the input that we process with our Managed Bean Student.java. As you seen in the index.xhtml file we have bind the value="#{student.fullname}"

002 - index file for JSF inputText

I hope you have learned about JSF h:inputText. If you have any questions or advice or suggestion please comments below.

More Usage Of h:inputText Tag

So the above xhtml page will render like this.

001 - JSF inputText

So as you have seen that inputText we can use to set the specific value that no one can change. Or either we can use to set some default value and if user wish to change they can change.

And also we can give the user the empty box where your user can input their text.

Note / Caution:

you are not using <h:form> jsf tag you will see this error.

withou form error

Source Code:


If it helps you please inspire me just saying something about my work. Thank you.

Leave a Reply

Notify of