Generating JSF Pages from an Entity Class
See Also
An entity class is a class that uses the Java Persistence API to access a data source.
In a web application project, you can use the JSF Pages from Entity Classes wizard to
generate a series of JSP pages that use the JSF framework and the
entity classes to access entries in the database and provide CRUD functionality (Create, Read, Update, Delete).
The JSP pages use JSF components.
To generate JSF pages from an entity class:
- Choose File > New (Ctrl-N) from the main menu.
- From the Persistence category, select JSF Pages from Entity Class and click Next. The wizard displays all of the entity classes in the project.
- Add all of the entity classes for which you want to generate JSF pages to the Selected Entity Classes list and click Next.
- Specify a package for the JPA controller and JSF classes.
The default location is the folder containing the selected entity classes.
- (Optional) Specify a folder in which to place the JSF pages.
- Select Ajax-enabled generated pages if you want the IDE to add the necessary libraries and JavaScript files
to enable the use of Ajax requests.
- Click Finish.
When you click Finish the IDE generates the following artifacts for each entity class.
- JPA controller classes.
For each entity class the IDE creates one JPA controller class in the specified location.
- JSF classes. For each entity class the IDE creates one JSF controller class and one JSF converter class and places the classes in the specified location.
- JSP pages.
For each entity class, the IDE creates four JSP pages that are used to view, edit, create, and destroy entries in the data source.
The IDE also creates the following:
- Four Java classes used by the JPA controller classes for handling exceptions
(IllegalOrphanException.java, NonexistentEntityException.java, PreexistingEntityException.java,
RollbackFailureException.java)
- Three JSF utility classes
(JsfUtil.java, PagingInfo.java, and JsfCrudELResolver.java)
- Default stylesheet and JavaScript files
- See Also
- About Web Application Frameworks
- Adding JSF Support to an Existing Application
- Generating JPA Controller Classes from an Entity Class
- About CRUD Applications
- Creating an Entity Class
- Generating Persistent Entity Classes from a Database
Legal Notices