Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

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.
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
Police line, do not cross. Well, this tiny ad can go through:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic