Generate JSF2 CRUD's - Can I create the bean a

2019-09-19 10:27发布

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条回答
戒情不戒烟
2楼-- · 2019-09-19 11:04

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

查看更多
登录 后发表回答