First, create your application. In this case, I create a Maven Web Application by choosing "New Project"->"Maven"->"Web Application" (Figure 1).
Figure 1: Maven Web Application
Figure 2: New Java Package
After the package is created, right-click on it and select "New"->"Entity Classes from Database", which I've covered in a previous posting. This wizard allows me to select a set of database tables from one of my connections...here I choose my sample database and select the CUSTOMER table. After doing so, all related database tables are automatically added to the "Selected Tables" list...click next (Figure 3).
Figure 3: Create Entity Classes from Database
The next wizard page (Figure 4) allows me to select various options for generating my entity classes...I'll leave the defaults and click "Finish".
Figure 4: Entity Class Options
After doing so, the entity classes for my database have been generated. Now it is time to put the icing on the cake. Since the database entity classes are now available, I can generate the entire JavaServer Faces infrastructure with just a few clicks. Right click on the project's "Web Pages" folder and select "New"->"JavaServer Pages"->"JSF Pages from Entity Classes" (Figure 5).
Figure 5: Create JSF Pages from Entity Classes
Next, select all of the entity classes that have been created, and click "Next" (Figure 6).
Figure 6: Select Entity Classes
Figure 7: JavaServer Faces Configuration
Figure 8: Completed JSF Application
Note that you may need to right-click on your project "Dependencies" module and add PrimeFaces (Figure 9).
Figure 9: Add Maven Dependency
No comments:
Post a Comment
Please leave a comment...