Hey guys in this post, we will create a Login page in JavaServer Faces (JSF) with Eclipse/STS IDE.
Table of Contents
Complete example
We will create this example step by step, follow this tutorial till the end
Read More:
- Check the Complete JavaServer Faces (JSF) Tutorial
- Check the Complete Spring Data JPA Tutorial
- Check the Complete Spring Security Tutorial
- Check the Javascript Projects for Beginners
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="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Input Form</title>
</h:head>
<h:body>
<h:form>
Email: <h:inputText id="email" value="#{email}" />
<br/><br/>
Password: <h:inputSecret id="password" value="#{password}" />
<br/><br/>
<h:commandButton value="Login" />
</h:form>
</h:body>
</html>
- 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.
Hi Bushan,
JSF material is quite good, if possible provide hibernate using eclipse and tomcat server.
Thank you so much :).
Regards,
kkk.
Pingback: Login Page In Jsf – MySubwayCard
Pingback: Jsf Login Template – MySubwayCard