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 generate a series of JSP pages that use the JSF framework and the entity classes to provide read and write access to the entries in the database. 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.
- (Optional) Specify a folder in which to place the JSF pages.
- Specify a package name for the generated Java classes and click Finish.
The IDE generates the following artifacts for a CRUD application:
- Controller classes. A controller class is a wrapper for an entity class that provides clients with access to the database through the methods in the entity class. For example, the controller class has methods for creating and deleting an entry in the data source, getting all of the entries in the data source, or getting a specific entry in the data source. The IDE creates one controller for each entity class and places the controller in the same package as the entity class.
- Converter classes. A converter class takes input from the form and converts it into the type that matches the data in the data source.
- JSP pages. The JSP pages are the web user interface for accessing the data in the data source. For each entity class, the IDE creates four JSP pages that let you view, edit, create, and destroy entries in the data source.
- See Also
- About Web Application Frameworks
- Adding JSF Support to an Existing Application
- About CRUD Applications
- Creating an Entity Class
- Generating Persistent Entity Classes from a Database
Legal Notices