IntelliJ IDEA 2021.2 Help

Jakarta Server Faces (JSF)

Jakarta Server Faces (JSF), formerly known as JavaServer Faces, is a Java specification and MVC framework for building user interfaces for web applications.

IntelliJ IDEA provides the following:

Create a new Java Enterprise project with JSF

Since JSF is part of Jakarta EE (formerly known as Java EE), you can add support for it to any Java Enterprise web application.

  1. From the main menu, select File | New | Project.

  2. In the New Project dialog, select Java Enterprise.

    New Java Enterprise project wizard

    Select Web Application and other necessary settings and click Next to continue.

  3. In the Dependencies list, select the Server Faces (JSF) framework under Specifications and click Next.

  4. Enter a name for your project and click Finish.

IntelliJ IDEA creates the default project structure with the javax.faces library as an external dependency. If you specified an application server, IntelliJ IDEA will also create a run configuration to start the server, build and deploy the artifact.

Enable JSF support for an existing Java Enterprise project

If you already have a Java Enterprise web application, you can add the JSF framework as a facet.

  1. In the Project tool window, right-click the necessary module and select Add Framework Support.

  2. Select JSF and choose whether you want to use an existing library, create a new one, download the suggested library files, or configure the library later.

  3. If you want to create the JSF configuration file, select Create faces-config.xml.

  4. Click OK to apply the changes to your project.

The JSF configuration file faces-config.xml defines the navigation rules between the pages of your web application. IntelliJ IDEA provides a diagram that you can use to see and draw the navigation rules instead of editing the configuration file.

  1. Open faces-config.xml in the editor and click the Navigation tab at the bottom.

  2. Drag the required pages (one at a time) from the Project tool window to the Navigation tab.

  3. Click and drag to draw the navigation lines from one page to another. IntelliJ IDEA will create the corresponding navigation rules in faces-config.xml. Switch to the Text tab to see those rules.

Using the navigation diagram to create the navigation rules
Last modified: 15 June 2021