First JSF Project

The course is part of this learning path

First JSF Project
1h 9m

In this course, we will learn the concepts of Java EE 7 with a focus on JavaServer Faces.

Learning Objectives

  • What JavaServer Faces are

Intended Audience

  • Anyone looking to get Oracle Java Certification
  • Those who want to improve Java 7 EE knowledge
  • Java developers


  • Have at least 2 years of Java development experience 

Hello, dear friends. In this video, we will create our first web application with JSF. Let's begin. First, open Eclipse. In the top right corner, as you can see, we have a Java EE perspective button. If you can't see anything, you can add a perspective with the add perspective button. Before we begin, I'd like to add a tool to my Eclipse that will provide us with a significant advantage for JSF, JSP, and RESTful operations. Now, search jboss. Now, as you can see, this tool is an umbrella project for a set of Eclipse plugins that includes support for JBoss and related technologies, such as Hibernat, Jboss AS/Wildfly, CDS, Openshift, Apache Camel, Red Hat, JBoss Fuse, Docker, JSF, HTML, XHTML, Maven, and more. Install it. This will take a little time. Continue installation. Done. Now we are ready to create our first project with JSF. File, New. Now, we will select Dynamic Web Project.

Give a project name. As you can see, GlassFish is already selected. Now, we have to modify default configuration. Select JSF. 'OK' and 'Next'. 'Next' again. Now , we have to check "Generate web.xml deployment". Otherwise, we have to add this XML to our project manually. 'Next' again. The GlassFish four server includes JSF 2.2 on the system path, so we don't need to add another JSF library to our project. Now, 'Finish'. We have finally created our JSF project. In the Java Resources folder, navigate to Libraries directory. You will see our jar file is listed here. In the SRC folder, we will store our managed beans. In the WebContent directory, we will hold our design pages. Let's create the first page. Right click 'New', 'XHTML page'. 

If you like, you can add an XHTML to an HTML file by changing the file extension. Give a name to your file. Click 'Next'. In this section, we will select the X HTML template. Actually, you can use JSP files with JSF if you want, but I'll stick with XHTML files. I will select 'Blank JSF Page' and 'Next.' The last step is finished. There are three tags that we can use in JSF. We'll mostly be using H and F tags. We may also use the UI tag at times. Now, let's write some HTML codes.

Now, to see this page, we have to adjust Web XML file with XHTML files. Look, there are many extension types to choose from when starting a project, but there is no XHTML page. We must add something, otherwise we won't be able to see the index XHTML page in the browser. Welcome file index, XHTML. Done. Start GlassFish server. Run. Look, now we have a web page. Let's take a break here. In the following video, we will examine the managed bean and scope annotations, which we will use in JSF operations. See you in the following video.


About the Author
Learning Paths

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.

Covered Topics