Idea logo

The IntelliJ IDEA Blog

The Capable & Ergonomic Java IDE by JetBrains


JSF Application in Just Two Clicks

IntelliJ IDEA Java EE support was beefed up with the very interesting feature. Now you can build a database Web interface in literally a few mouse clicks. Well, okay, at least get yourself a starting point, which is way better that beginning from scratch.

I must note that there are some prerequisites, though:

  1. A Web Module that is used to host the Persistence Unit
  2. Persistence Unit that is used to encapsulate the database access

Details about creating Web modules, Persistence Units and mapping them to various datasources can be found in the IntelliJ IDEA built-in help, under Java EE Support, EJB Support and Web Application Development sections.
After the prerequisites are met, follow this simple step-by-step procedure:
Remember to switch to the Java EE View for performing the steps below

  1. Right-click the Persistence Unit and select Generate Faces Pages


  1. In the Create application files in field type the path where you want to store all the generated files.
  2. In the Create Manage Beans in package specify the package where you want to create the Managed Bean classes.
  3. From the Store facelets configuration list select the JSF configuration file where JSF configuration descriptor will be placed. This list contains all JSF configuration files eligible for the project.
  4. In the Use this suffix for Managed Bean names specify the suffix that is added all generated Managed Bean names.
  5. Select the Create separate subdirectory for each of the entities if you want to create separate folder for each of the entities and place all generated files that are used to access that entity.
    If you clear this option, the Automatically generate page names is selected to prevent from ambigous file names.

After the settings are configured, define what pages you want to generate:

  1. Under the Entity column select what entities you want to generate interface pages for.
  2. Under Edit, View, List, Create columns select what template should be used to generated the data access pages. Note that selecting a template from the column header overrides setting for the entire column.
    Remember that templates can be managed through the File Templates dialog and so you have the option to create the data access pages from your custom templates that contain functionality and layout of your choice.
  3. Under Managed Bean column select template that will be used to generate the Managed Bean code.
  4. Select a tab below the table to examine what code will be generated for each of the pages.
  5. Click Generate.

IntelliJ IDEA generates the specified application files and you can try it by compiling and deploying the module to an application server.

Download the 6.0.2 release of IntelliJ IDEA and try this feature. You may also want to join IntelliJ IDEA EAP and watch the latest improvements and additions.

Technorati tags: , , ,
Comments below can no longer be edited.

8 Responses to JSF Application in Just Two Clicks

  1. Avatar

    Behrang says:

    November 23, 2006

    This is great! Fantastic for prototyping! Long live JetBrains 🙂

  2. Avatar

    Maddy says:

    October 23, 2008

    I don’t see this feature for Intellij 8.0 RC1. I wasted quite a time looking around if I was doing anything wrong.

  3. Avatar

    egor.malyshev says:

    October 30, 2008

    I’ve checked twice, this feature is available in IntelliJ IDEA 8M1.

    Please contact me by email (, I’ll help you find it.

  4. Avatar

    Marioosh says:

    March 26, 2009

    I can’t find it too. I Have got project with JPA Hibernate , Hibernate and JSF Faclets, and i can’t find thes feature.

  5. Avatar

    ayeshan says:

    May 28, 2009

    Can you please publish here, how to find this feature in 8M1?

  6. Avatar

    Egor Malyshev says:

    May 28, 2009

    In short, with version 8 you should do this:
    1. Open the Project Structure dialog and configure a module with Web Facet, JSF Facet and JPA Facet. Don’t forget to bind JPA Facet to Web.
    2. Switch Project View to Java EE, right-click the JPA Facet, select New and then Persistence Unit.
    3. Bind the persistence unit to a data source by right-clicking it and then selecting Generate Persistence Mapping, Database Schema.
    4. After the mapping is generated, do as described above.

  7. Avatar

    Kebten says:

    July 10, 2014

    If one is new to Java “two clicks” soon becomes 100 clicks as one uncovers all the tasks one has to accomplish before one can even follow the content of this post. Don’t find Intellij built-in help so far particulary helpful.

  8. Avatar

    Ferran Closa says:

    May 12, 2016

    in version 14, it takes 19 clicks!
    But it’s mostly about knowing what to look for.
    Select View, Tool Windows and Persistance.

    However to have the Persistance Menu, you have to have activated the correct facets. and of course have a data base ready. and you probably must have run the persistance mapping for Table and Class. It’s pretty cool, and I use it mostly for prototyping, produce CRUD basics over which to build on.

Discover more