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

Screenshot

  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: , , ,
This entry was posted in New Features and tagged , . Bookmark the permalink.

7 Responses to JSF Application in Just Two Clicks

  1. Behrang says:

    This is great! Fantastic for prototyping! Long live JetBrains :-)

  2. Maddy says:

    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. egor.malyshev says:

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

    Please contact me by email (egor.malyshev@jetbrains.com), I’ll help you find it.

  4. Marioosh says:

    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. ayeshan says:

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

  6. 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. Kebten says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">