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:
- JPA Session Bean Package: (contains EJB session beans)
- JSF Classes Package: (contains JSF session-scoped, managed beans)
- JSF Pages Folder: (contains all Facelets pages generated for entity classes)
- Localization Bundle Name: (the properties bundle that
will contain all text used in 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:
- a stateless session bean for creation, retrieval, modification and
removal of entity instances
- a JSF session-scoped, managed bean
- a directory containing four Facelets files for CRUD capabilities (
Create.xhtml
,
Edit.xhtml
, List.xhtml
, and View.xhtml
)
- 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.)
- auxilary 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