IntelliJ IDEA
IntelliJ IDEA – the Leading Java and Kotlin 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:
- A Web Module that is used to host the Persistence Unit
- 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
- Right-click the Persistence Unit and select Generate Faces Pages
- In the Create application files in field type the path where you want to store all the generated files.
- In the Create Manage Beans in package specify the package where you want to create the Managed Bean classes.
- 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.
- In the Use this suffix for Managed Bean names specify the suffix that is added all generated Managed Bean names.
- 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:
- Under the Entity column select what entities you want to generate interface pages for.
- 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. - Under Managed Bean column select template that will be used to generate the Managed Bean code.
- Select a tab below the table to examine what code will be generated for each of the pages.
- 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.