• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

count od Managed Beans for page

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic