What is Java Server Faces and How to use it?

Java Server Faces is an MVC based framework to design User Interface for Server Side Technologies. We can use UI widgets in server based event handlers. The Java Servlet container is used to run these applications. JSF provides core libraries, UI components and many more extended features to create a well defined UI for Web server applications. In crux, JSF or Java Server Faces is a standard technology which is highly used in the Java Developers Community.

Java Server Faces Architecture

JSF architecture is based on the MVC (Model View Controller) architecture. UI Components can be rendered in many ways like Computing Device, HTML browser etc. The diagram for the JSF architecture is shown as follows.

Java Server Faces Architecture

Advantages of JSF

JSF is highly advantageous due to the following reasons:

  1. Presence of Reusable UI components
  2. JSF manages multiple server requests at a time
  3. Multiple Custom components can be used by implementing JSF
  4. Simple and Easy to maintain

Lifecycle of JSF

JSF lifecycle contains 6 phases as mentioned in the figure below.

Java Server Faces Lifecycle

Steps to create a simple JSF application:

The basic requirement is to install the archetype-webapp plugin. The step by step implementation in given below for Windows Operating System using Eclipse IDE.

  1. Open command prompt (cmd) to set the path for JSF application
  2. use the command: mvn archetype:create to initiate mavern
  3.  Add the JSF capability to the project. Also add all the JSF dependencies to the project.
  4. Open Eclipse IDE and create a new Java project
  5. Import the project created earlier using JSF capability using import button in Eclipse
  6. Configure the Faces Servlet in web.xml file of the project created in Eclipse
  7. Create a Managed Bean for the given package of the java program
  8. Create a JSF page under the web app directory in Eclipse IDE.
  9. Build the project and run it as an maven package
  10. Deploy WAR file, run the a wizard project and start the tomcat server.
  11. Run the complete application using the run command, which will launch the application on the server

7 Comments

  1. SEO Service said:

    Awesome post! Keep up the great work! 🙂

    January 30, 2020
    Reply
  2. Irma Vieth said:

    Hiya, I am really glad I have found this information. Today bloggers publish only about gossip and web stuff and this is really irritating. A good web site with interesting content, that is what I need. Thank you for making this website, and I’ll be visiting again. Do you do newsletters by email?

    June 1, 2020
    Reply
    • admin said:

      Thanks Irma for your kind words. We will try to do such work in future as well. We will soon update the newsletter link.

      June 1, 2020
      Reply
  3. Dollie Wilber said:

    It is in-fact a great and helpful piece of info. I am glad that you simply shared this helpful information with us. Please stay us up to date like this. Thanks for sharing.

    June 2, 2020
    Reply
    • admin said:

      Thanks Dollie for your appreciation

      June 2, 2020
      Reply
  4. Jamaal Meccia said:

    I simply want to tell you that I am just all new to blogs and definitely savored your page. Probably I’m likely to bookmark your blog . You definitely have remarkable well written articles. Thank you for sharing your webpage.

    July 4, 2020
    Reply
    • admin said:

      Thanks Jamaal for your kind words!!

      July 5, 2020
      Reply

Leave a Reply

Your email address will not be published.