`
kevintse
  • 浏览: 11033 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类
最新评论

JSF: Managed Bean VS. Backing Bean

    博客分类:
  • Java
阅读更多
(Quoted from here)
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.[flash=200,200][/flash]
分享到:
评论
2 楼 kevintse 2007-12-21  
"because the JSF specification has no explicit definition for those terms", you may just treat the both as the same.

but from the book I read(JSF: The Complete Reference), I would like to take a bean as a becking bean when its properties are used to bind the UI components proper(not the values of them). and just as the post I quoted above, "becking bean is the role managed bean plays to be a server-side representation of the components located on the page".
1 楼 xuejianshan 2007-12-21  
you are very strong,i don't read if difficlty!

相关推荐

    jsf spring

    在JSF的faces-config.xml或使用注解(@ManagedBean, @Inject)来声明和配置Spring Bean。 3. **数据访问**:Spring提供了多种数据访问接口,如JdbcTemplate、HibernateTemplate或JPA。这些可以被JSF的 backing beans ...

    jsf,radiobutton分组示例

    1. `BackingBean.java`: 这是后台Bean,它会定义`selectedOption`属性和`optionsList`属性。`selectedOption`存储用户的选择,而`optionsList`通常是一个`List<SelectItem>`,包含了所有可选项的文本和值。 ```java...

    JSF技术总结文档.doc

    在JSF中,Backing Bean(或称为Glue Bean)扮演着关键角色,它们是连接用户界面(UI)和业务逻辑的桥梁。Backing Bean通常是Java Bean,它们在`faces-config.xml`配置文件中被定义和管理。例如: ```xml <managed-...

    Backing Beans.htm

    当用户在JSF界面中进行操作,如点击按钮或填写表单时,这些动作会触发后台的Backing Bean方法,从而执行相应的业务逻辑。 Backing Beans有两种主要类型:Managed Beans和Session Beans。Managed Beans是在请求之间...

    JSF 入门学习资料

    5. **编写后端Bean**:创建一个Java类,标记为JSF managed bean,实现业务逻辑。 6. **运行和测试**:在Meclipse中启动内置服务器,访问你创建的JSF页面,检查功能是否正常。 在提供的压缩包中,很可能包含了一本...

    清晰版--JSF入门.pdf

    它们可以是任何实现了`javax.faces.bean.ManagedBean`注解的Java类。 **2.2 Beans的配置与设定** Managed Beans可以通过XML配置文件(faces-config.xml)或者通过`@ManagedBean`和`@SessionScoped`等注解来配置。...

    JSF live demo 最新完整源代码

    8. **依赖注入**:JSF支持JSR-330标准的依赖注入,如使用`@ManagedBean`和`@EJB`注解,可以在Backing Bean中注入其他服务或资源。 9. **国际化和本地化**:JSF支持多语言环境,通过资源包(Resource Bundle)可以...

    JSF is import

    - **Managed Bean与Backing Bean**:Managed Bean是JSF中用于管理状态的对象,可以是任何Java类,但通常标记为@ManagedBean注解。Backing Bean则是与特定页面或组件关联的Bean,用于处理页面上的数据和事件。 - **...

    JSF入门级教程

    例如,#{bean.property}可以获取或设置Bean的属性值。 6. 国际化讯息 JSF支持资源包(resource bundle)机制,用于提供不同语言的文本。通过修改资源包,你可以轻松地为应用添加多语言支持。 7. Managed Beans ...

    JSF配置.pdf

    一个典型的JSF程序包括几个主要组件:JSF页面、Managed Beans、配置文件等。开发者需要编写JSF页面,这些页面包含HTML和JSF标签。Managed Beans用于处理应用程序逻辑,而配置文件(如faces-config.xml)则用于配置...

    JSF入门文档

    - **Backing Beans**:一种特殊的Managed Bean,主要用于支持页面中的组件。 - **数据转换与验证**: - **标准转换器**:JSF内置了一系列的标准转换器,用于将用户输入的数据转换成对应的Java类型。 - **自定义...

    ADF培训_10_JSFIntroduction_2009

    Managed Beans有多种范围,如Application、Session、Request,以及特定于ADF的BackingBean、View和PageScope。它们可以根据需要由JSF懒加载初始化。 定义Managed Bean时,需要指定Bean的名称、类和作用域。例如,...

Global site tag (gtag.js) - Google Analytics