托管Bean和后备Bean之间的区别 [英] Difference between managed bean and backing bean
问题描述
我在几个论坛中遇到过托管bean"和备用bean"这两个术语.许多人认为两者是相同的.但是,似乎有细微的差别.谁能帮助我理解这两个术语的确切区别?
I came across the terms "managed bean" and "backing bean" in several forums. Many people think both are the same. But, there seems to be a slight difference. Can any one help me to understand the exact difference between these two terms?
推荐答案
更改我的初始答案-两者之间没有有意义的区别. 教程说,以后将支持bean声明为托管bean.因此,总结一下:
Changing my initial answer - there is no meaningful difference between the two. The tutorial says that backing beans are later declared as managed beans. So, to summarize:
- 支持bean是上下文之外的类
- 只要声明要与JSF托管Bean工具一起使用,托管Bean就是支持Bean.
我从未真正使用过支持bean"一词,因为我发现它没有用.因此,最好只使用托管bean".请注意,在JSF 2.0(和CDI)中,您有@ManagedBean
-,因此您的bean是托管bean.
I've never actually used the term "backing bean", because I found no use to it. So you might be better off using only "managed bean". Note that in JSF 2.0 (and in CDI) you have @ManagedBean
- so your bean is a managed bean.
BalusC建议以"backing bean"为定义,而"managed bean"为实例.尽管这可能是JSF创建者的初衷,但我认为不值得支持它.例如,CDI和spring对于"bean定义"和"bean实例"没有不同的术语.
BalusC suggested that "backing bean" is the definition, and "managed bean" is the instance. While this might have been the original idea of JSF creators, I don't think it is worth supporting it. CDI and spring for example don't have different term for "bean definition" and "bean instance".
JSF 2.0规范仅几次提及术语"backing bean",没有任何定义.除此之外,它还提到了"backing bean class",这可能意味着"backing bean class"!="backing bean class",这带来了进一步的混乱.
The JSF 2.0 specification mentions the term "backing bean" only a few times, with no definition whatsoever. In addition to that it mentions "backing bean class", which might mean that "backing bean" != "backing bean class", which brings further confusion.
总而言之-对我来说,两者都是可以互换的,我坚持只使用托管bean"
So to conclude - for me both are interchangeable, and I'd stick to only using "managed bean"
这篇关于托管Bean和后备Bean之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!