Generating JSF Pages from Entity Classes
See Also
If you have already
generated
entity classes from a database in your project, you can use the JSF Pages
from Entity Classes wizard to generate a collection of files, classes and front-end
pages that enable you to interact with the database. The purpose of the wizard
is to provide template code that facilitates CRUD
functionality with a back-end data store.
To generate JSF pages from an entity class:
- Choose File > New (Ctrl-N) from the main menu.
- From the JavaServer Faces category, select JSF Pages from Entity Class and
click Next. The wizard displays all of the entity classes in the project.
- Specify the entity classes for which you want to generate JSF pages. To do so,
click Add (or Add All) to move entity classes to the Selected Entity Classes
list.
- Click Next.
- In Step 3: Generate JSF Pages and Classes, specify a name for the following
fields:
- Session Bean Package. This package contains the session facades for the entity classes.
- JSF Classes Package: This package contains JSF session-scoped, managed beans.
- JSF Pages Folder: This folder contains the Facelets pages generated for the entity classes.
- Localization Bundle Name: The properties bundle
contains all the text used in the Facelets pages as key-value pairs.
- Click Finish.
The IDE generates all files based on the names and locations you specified in the wizard.
For each entity class the wizard generates the following files.
- a stateless session facade that extends an abstract facade
- a JSF session-scoped, managed bean
- a directory containing four Facelets files for CRUD capabilities (
Create.xhtml,
Edit.xhtml, List.xhtml, and View.xhtml)
The IDE also generates the following files.
- an abstract facade class with methods for the creation, retrieval, modification and
removal of entity instances
- utility classes used by the JSF managed beans (
JsfUtil,
PaginationHelper)
- a properties bundle for localized messages, and a corresponding entry in
the project's Faces configuration file (A
faces-config.xml file is
created if one does not already exist.)
- auxiliary web files, including a default stylesheet for rendered components,
and a Facelets template file
- See Also
- About JSF CRUD Applications
- About Java Persistence
- Generating Persistent Entity Classes from a Database
- About JavaServer Faces Framework Support
Legal Notices