Behrang Saeedzadeh wrote:
Hi,
What is the difference between a managed-bean and a backing-bean?
1) Aren't all backing-beans, managed-beans as well?
2) In which scenarios a managed-bean is not a backing-bean?
I browsed through the JSF 1.1 spec and I couldn't find the definition
for either of these terms. Overall I think the spec lacks a glossary
(local value, etc. are not defined formally anywhere in the sepc.)
A "managed bean" is something defined in a faces config file using the
<managed-bean> tag.
AFAIK, the term "backing bean" is not a term used by the JSF spec at
all. It's a common web development term (struts, etc) that doesn't
entirely map to the JSF concepts. My personal interpretation is that
when a page (jsp/facelets/etc) contains EL expressions that mostly or
entirely map onto a single managed bean, then that managed bean can be
called the "backing bean" for that page. Note, however, that there is no
requirement in JSF for a page to access only one managed bean; it can
access a dozen if it wishes, in which case the term "backing bean"
really can't be applied.
And if I were using the Apache Shale View Controller, then I might use
the term "backing bean" to talk about the object that receives the
view-based callbacks, even if the associated page accesses a range of
other managed beans.
Cheers,
Simon