Sunday, 24 July 2016

Getting Started With JSF - Preparing The Environent and Creating the First JSF Application

Hello everybody!

This post will be something like "Introduction to JSF" :) So if you are new to JSF, I think this is a good place for you to start.



JavaServer Faces (JSF) is a MVC web framework that simplifies the construction of user interfaces (UI) for server-based applications. It is a very popular and standard way of building web application in Java. It provides a huge range of UI components and custom tags. It is also extendable so you can add third-party JSF UI components(such as Primefaces, Richfaces) into your application. JSF allows you to manage your application state for Web requests and provides built-in validation rules. These are really not enough to describe how powerful this framework is. Although there are some people who don't have a good impression about JSF, I still think every technology has its up and down sides. So it is better to get more into JSF and see it yourself. JSF 2.2 was released in 2013 and JSF 2.3 is expected to be released in 2017. Now let's see what we need to do to create a JSF Application.

You will need to make sure that you have the followings installed on your machine.
-JDK (Please go here to see how to install JDK)
-Eclipse
-Apache Tomcat (or some other server for JSF 2.2)(Please go here to see how to install Apache Tomcat)
You don't need to download JSF JAR files manually. Eclipse can automatically download the JSF JAR files and include them in your project. I am going to show you how to do it.

You are good to go when you finish installing those above. Now it is time to create the first JSF application.

STEP 1

Start Eclipse and go to File-> New-> Dynamic Web Project. You will see a window like below. In this window enter you project name and then click the "Modify" button.

STEP 2

Clicking the "Modify" button, you are going to get the screen below. Put a tick next to "JavaServer Faces" option and then hit "OK". Then click "Next" on the following window.

STEP 3

After a few "Next" button clicking, you will get "JSF Capabilities" window. Select "User Library" in the dropdown list.Then  click the download button which I marked as 2 on the image below. 

This download button is going to search for JSF libraries and download them. As you can see in the image below, Eclipse has found JSF 2.2 (Mojarra 2.2.0). Simply select this library by clicking on it and then hit "Next". This will start the download. So that is how Eclipse itself download the necessary JSF files.

You are going to be asked to accept the term of licence. You should agree and click "Finish "like below.

STEP 4

When it finishes the download, you will see a window as shown below. Simply click "Finish" in this step and your first JSF application is created!


Hope to see you in the next blog post.

Selen

No comments:

Post a Comment