JavaServer Faces (JSF) Create Login Page

Hey guys in this post, we will create a Login page in JavaServer Faces (JSF) with Eclipse/STS IDE.

Complete example

We will create this example step by step, follow this tutorial till the end

Read More:

Create Dynamic Web Project

To create a dynamic web project, you can read the following tutorial

Create Input form

Create login-form.xhtml file inside the WebContent and add the following content

<!DOCTYPE html>
<html xmlns=""

		<title>Input Form</title>
			Email: <h:inputText id="email" value="#{email}" />
			Password: <h:inputSecret id="password" value="#{password}" />
			<h:commandButton value="Login" />

  • At the top we will reference to the JSF HTML components
  • <h:inputText /> is used to create textbox
  • <h:inputSecret /> is used to create password field

Run the app

To run the application, right click on the project, select Run As -> choose Run on Server

Open the browser, navigate to the URL http://localhost:8080/JSF-hello-world/faces/login-form.xhtml

That’s it for this post. If you like this post, then please share this with your friends and collogues. Also share this post on your social media profiles as well.

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

This Post Has 3 Comments

  1. Kavitha

    Hi Bushan,
    JSF material is quite good, if possible provide hibernate using eclipse and tomcat server.
    Thank you so much :).


Leave a Reply