问题
I'm looking for any kind of software which allows me to generate, in an automatically way, the MVC files (a bean and a xhtml view) of any CRUD of any entity using Java Server Faces 2 and Richfaces 4 technologies.
I think one solution would be to use the Hibernate Tools plugin for Eclipse, creating an exporter like the Dao code generator but I don't know if it is possible or how can i do that. I search but I didn't find any documentation about it.
Do you know which is the best solution for this issue? Any other interesting software?
Thx!
回答1:
Netbeans has that feature, based on an entity class it can generate CRUD. This is what it generates for each entity you choose:
- a stateless session bean that extends AbstractFacade.java
- a JSF session-scoped, managed bean
- a directory containing four Facelets files for CRUD capabilities (Create.xhtml, Edit.xhtml, List.xhtml, and View.xhtml)
also it will generate:
- the AbstractFacade.java class that contains the business logic for 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
you'll have to update the generate code to use richfaces.
Here's a tutorial on how to do it: https://netbeans.org/kb/docs/web/jsf20-crud.html
来源:https://stackoverflow.com/questions/16274149/generate-jsf2-cruds-can-i-create-the-bean-and-xhtml-automatically-for-any-ent