How to Add JSF Library to a maven-based Web Application in NetBeans IDE

Posted on

Introduction

This article is a continuation from the previous article. It is an article with the title of ‘How to Create maven-based Web Application in NetBeans IDE’ and it is available in this link. On the other hand, the focus in this article is to add a JSF library support to the web application. It is necessary for the web application to run and process the JSF web page file. In general JSF is a Java-based web application library. It is intended to simplify development integration of web-based user interfaces. Moreover, JavaServer Faces is a standardized display technology, which was formalized in a specification through the Java Community Process.

Actually, it is similar with JavaServer Pages (JSP) to be able have the functionality for accessing server-side data and logic. JSP is essentially only an HTML page with server-side capabilities. But JSF is more than that. It is an XML document that represents formal components in a logical tree. JSF components itself are backed by Java objects, which are independent of the HTML and it has the full range of Java abilities, including accessing remote APIs and databases. So, JSF as a framework has the key idea to encapsulate (or wrap) client-side technologies like HTML, CSS, and JavaScript, allowing developers to build web interfaces without much interaction with these technologies.

How to Add JSF Library to a maven-based Web Application in NetBeans IDE

This article actually has a connection with the previous article.That previous article is an article with the title of ‘How to Create maven-based Web Application in NetBeans IDE’. It is an important article exist in this link where it contains step to accomplish the purpose in this article. In that article, the main goal is only to create a maven-based Java web application. On the other hand, in this article, it is going to add the support of the JSF framework to the maven-based Java web application. It is pretty easy actually, just do the following steps :

  1. As usual, just run the NetBeans IDE. Since in this example, it is using NetBeans IDE to build the maven-based Java web application.

  2. Open the maven-based Java web application. In order to do that, just access the menu of File > Open Project… as in the following image :

    How to Add JSF Library to a maven-based Web Application in NetBeans IDE
  3. After clicking the menu above, the window for opening the project will appear :

    How to Add JSF Library to a maven-based Web Application in NetBeans IDE

    Choose or select the maven-based Java web application where it is the name of ‘webapp’ as in the above image. The icon is also unique which is describing a maven-based Java web application.

  4. Continue on the previous step, just right click at the project and choose or click the Properties menu where it will appear a window configuration display as follows :

    How to Add JSF Library to a maven-based Web Application in NetBeans IDE
  5. Click the Framework menu as it exist in the left part of the above window configuration display where it shows the maven-based Java web application properties. The following is the appearance of the framework tab showing the available framework properties for the maven-based java web application :

    How to Add JSF Library to a maven-based Web Application in NetBeans IDE

    By default, it is empty because at first there will be no framework at all. Unless, at the first time when the process for creating the maven-based Java web application, there is an additional step to also include or to add the framework. But since it is not, there will be no framework available in the display above.

  6. Next step, just click the Add… button in order to add the JSF framework to the maven-based Java web application. By clicking it, the following display will appear :

    How to Add JSF Library to a maven-based Web Application in NetBeans IDE

    Normally, there are just those framework available to select or to choose. Just select or choose JavaServer Faces as in the above image. Following after, click the OK button. In order to close the maven-based Java web application properties, just click another OK button. It will redirect back to the NetBeans IDE display.

  7. By applying to add the JavaServer Faces library to the maven-based web application project, it will try to redeploy the maven-based web application project once more. If it is a success, there will be a change in the main page display. It is not displaying ‘Hello World’ anymore, but it will display the following main page :

    How to Add JSF Library to a maven-based Web Application in NetBeans IDE

4 thoughts on “How to Add JSF Library to a maven-based Web Application in NetBeans IDE

Leave a Reply