• Post Reply Bookmark Topic Watch Topic
  • New Topic

count od Managed Beans for page

 
manu chaox
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table with a form for it on a page. There are more approaches for managing.
I have seen one managed bean for one crud functionality(form and table), but one a managed bean for table AND other managed bean for the form as well.
Which approach is better choice and why, one or more managed beans for crud ?

I will be grateful for explanation.
 
Kamal Wickramanayake
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To support the pages, you use managed beans which are simply known as backing beans (since they support pages). You may be able to use one backing bean to support couple of views if your views are not that complex. Otherwise you will write one backing bean for one view. Less is good if you can do it without diluting the focus of the backing bean.

For data access from the database (CRUD operations), you may use other managed beans. Such a bean will be used in many other places (many other managed beans). It's just implementing good separation of concerns.

You can have a look at this which illustrates the above points: Best way to use JPA in web-tier
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!