permaculture playing cards
The moose likes JSF and the fly likes managed -and backing beans question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "managed -and backing beans question." Watch "managed -and backing beans question." New topic

managed -and backing beans question.

manuel aldana
Ranch Hand

Joined: Dec 29, 2005
Posts: 308

here some uncertainties from my side:

backing beans are related (->as model) to the components in a jsf-page (like swing beans). Does it mean, that per control and site(e.g. <h:inputText .../> in bla.jsp) there exists one instance of a backing-bean, i.e. all jsp-tags (core&html) refer to one node in an ui-component tree of a site?

it is not clear too, how the relation between backing beans and managed beans is meant. managed beans are "self"-written beans to tie my web-application to the business-tier (of course they should not themselves be business-objects). backing-beans are related to managed beans in that way, that backing-beans are somehow the glue to read/write the values of my forms to my managed beans.

i am a bit confused because some sites mention, that managed beans ARE backing beans.


aldana software engineering blog & .more
Sergey Smirnov
Ranch Hand

Joined: May 29, 2003
Posts: 167
Vice versa. The backing bean is a managed bean.

Managed bean is about how the bean is created and initialized. As you know, jsf uses the lazy initialization model. It means that the bean in the particular scope is created and initialized not at the moment when the scope is started, but on-demand, i.e. when the bean is first time required.

Backing bean is about the role a particular managed bean plays. This is a role to be a server-side representation of the components located on the page. Usually, the backing beans have a request scope, but it is not a restriction.

If you use or try to work with Java Studio Creator, you can find the backing bean work more explicitly. The same for Shale, because it is designed by the same architect. Generally, it is not required by specification to bind all the components with the properties of the backing bean, so, on practice, the differentiation between the backing bean and managed bean is not evident. Sometimes people call all the beans like backing beans even they are just used for value binding. There is no a thumb rule here, just because the JSF specification has no explicit definition for those terms.

Sergey :
I agree. Here's the link:
subject: managed -and backing beans question.
It's not a secret anymore!