Simon Lessard and Gus,
Respectfully, while books on JSF may help establish the culture and
conventions of the JSF community, they certainly are no replacement for
the official specifications.
I quite dislike the narrow definition of "backing bean" as presented in
Core JavaServer Faces. I've found that the general JSF community uses
the term in a much broader sense, and being exposed to JSF initially
through this book gave me a bit of confusion on this point.
Instead, I prefer Simon Kitching's summary in this thread of the meaning
of the term. I think it sums up the common usage much more accurately.
Of course, it is also quite acceptable to use the term more loosely to
refer to any bean referenced from the view page through an EL expression.
If you follow the usage in the books, that's fine... just don't expect
people to assume that you are specifically using bindings to
UIComponents rather than some other EL.
Regards,
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
Gus wrote:
Yes, I agree. The JSF Complete Reference book also states like this.
Simon Lessard wrote:
Actually Core Java Server Faces uses backing bean when you use binding
attribute on tags. The backing bean is then the bean holding the
UIComponent
reference.
Regards,
~ Simon
On 12/17/06, Simon Kitching <[EMAIL PROTECTED]> wrote:
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