IntelliJ IDEA 2020.2 Help

Prepare for JSF application development

Make sure the Java Server Faces plugin is enabled

  1. Open the Settings/Preferences dialog Ctrl+Alt+S and select Plugins.

  2. In the right-hand part of the dialog, locate the Java EE: Java Server Faces plugin on the Installed tab and make sure that the checkbox next to it is selected.

    Enabling the Java EE: Java Server Faces plugin

Enabling JSF when creating a project or module

  1. To create a new project, click Create New Project on the Welcome screen or select File | New | Project from the main menu.

    To create a new module, open the necessary project and select File | New | Module.

  2. In the wizard that opens, select Java Enterprise on the left.

  3. From the Project SDK list, select the JDK that you want to use in your project.

    If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory.

    If you don't have the necessary JDK on your computer, select Download JDK.

  4. Select the Java EE version that you want to use, and specify the necessary application server.

  5. From the Additional Libraries and Frameworks list, select the Web Application checkbox.

  6. Select the version of the Servlet specification and select the Create web.xml checkbox if you want to create a deployment descriptor file together with the project.

  7. Under Web Application, select the JSF checkbox.

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

  9. Configure the library. You can use an existing library, create and use a new one, download the library files, or postpone setting up the library until a later time.

    Click Next.

    Creating a new JSF project
  10. On the next page of the wizard, specify the name and location for the new project or module. Click Finish.

As a result, your new module will contain:

  • The web and WEB-INF directories.

  • The file index.xhtml in the web directory. With minor modifications, you can use this file as a starting page of your application.

  • In the WEB-INF directory, if specified:

    • web.xml, the Web application deployment descriptor.

    • faces-config.xml, the JSF configuration file.

    The structure of the new JFS project
  • If specified, the JSF library or libraries included in the module dependencies.

  • An artifact specification for you module.

  • If you have specified the server, a run/debug configuration for running your application in the context of that server.

Enable JSF support for an existing module

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

  2. From the list on the left, select the Web Application checkbox.

  3. Select the version of the Servlet specification and select the Create web.xml checkbox if you want to create a deployment descriptor file together with the project.

  4. Under Web Application, select the JSF checkbox.

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

  6. Configure the library. You can use an existing library, create and use a new one, download the library files, or postpone setting up the library until a later time.

  7. Click OK to apply the changes and close the dialog.

    Adding JSF framework to a module

Last modified: 08 May 2020