Creating JSF Application by using Eclipse , Maven and Tomcat


Any tools etc we will see how you can write JSF code directly using the support on the Eclipse IDE without installing it.

First,go to this link and download the Eclipse application

We will choose this option after you turn on the installer. After click installation button, the installation process will start

We need a server to run the JSF code. Apache Tomcat, a lightweight and fast server software, is sufficient for this.

Install  Tomcat

If Apache Tomcat is not installed on your Eclipse IDE, follow these steps.

  • First go to tomcat site
  • Click on the latest release

  • Then download it by clicking on the zip file

After the download is finished, we click on the new dynamic project as below

Enter to new project name

  • Let’s choose Tomcat installed from the target runtime.
  • I will select Dynamic Web Module Version 3.0.
  • In the Configuration section, select the JavaServerFaces v2.2 Project.
  • Click on the Next button.

After modifying in configuration, extract the zip we downloaded and set the path as that folder.

Let’s go to the next screen by saying “Next”. On the next screen, click Generate web.xml deployment descriptor, and click Next.

On the screen now, Eclipse wants us to implement one JSF. We’ll get this down, too. Click the Download Library button on the screen.

Eclipse will search in the relevant repository and open up a screen where we will present a JSF implementation. In the screen that appears, select JSF 2.2 (Mojorra 2.2.0) and say Next.

Now click on the Finish button and tick the I accept the terms of this license. Mojorra will be downloaded for us and added to the Eclipse repository, and the screen will open when we click on the previous library download button.

If you have received a zip file is empty error, apply the solution from this link

Now right click on the opened project, select HTML File from the New section.

Change the name of the file to index.xhtml and click on the Next button.

Now we will select an HTML Template on the screen that opens. The Java Server Faces framework is a framework built on Facelet. Let’s choose the top New Facelet Composition Page from this screen and click on the Finish button.

Now let’s add HelloClass.java file under Java Resources -> src and update the code like this.

Let’s update our index.xhtml code as follows:

When we write the Eclipse IDE # {} bookmark and put it in brackets and make it crtl + space, it makes us a managed bean proposal. When we select the name of the managed bean and put the dot operator and ctrl + space again, it also lists the fields in the managed bean.

Now let’s right click on my project and run As -> Run On Server and run the project on the server.

Demo

Convert to Maven Project

Project right click -> Configure -> Convert to Maven Project and click to finish button.

plugin tag dependencies in pom.xml

 

 

if you have question do not forget to write from the chat button next to it or from the comment

You may also like...

4 Responses

  1. I as well conceive hence, perfectly indited post! .

  2. zvodret iluret says:

    wonderful post, very informative. I wonder why the other specialists of this sector don’t notice this. You should continue your writing. I am sure, you’ve a huge readers’ base already!

  3. Luc says:

    Had some trouble creating a JSF Project but this finally worked 🙂 Thx!

Leave a Reply

Your email address will not be published. Required fields are marked *