`
yanhua
  • 浏览: 87638 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

JSF中不同种类的managed-beans

阅读更多

在icefaces的博客上看到一篇文章——Making distinctions between different kinds of JSF managed-beans

,将JSF的managed bean进行了分类,可以借鉴参考一下:

 

 

Managed-Bean Type Nickname Typical Scope
Model Managed-Bean model-bean session

Description: This type of managed-bean participates in the "Model" concern of the MVC design pattern. When you see the word "model" -- think DATA. A JSF model-bean should be a POJO that follows the JavaBean design pattern with getters/setters encapsulating properties. The most common use case for a model bean is to be a database entity, or to simply represent a set of rows from the result set of a database query.

Backing Managed-Bean backing-bean request

Description: This type of managed-bean participates in the "View" concern of the MVC design pattern. The purpose of a backing-bean is to support UI logic, and has a 1::1 relationship with a JSF view, or a JSF form in a Facelet composition. Although it typically has JavaBean-style properties with associated getters/setters, these are properties of the View -- not of the underlying application data model. JSF backing-beans may also have JSF actionListener and valueChangeListener methods.

Controller Managed-Bean controller-bean request

Description: This type of managed-bean participates in the "Controller" concern of the MVC design pattern. The purpose of a controller bean is to execute some kind of business logic and return a navigation outcome to the JSF navigation-handler. JSF controller-beans typically have JSF action methods (and not actionListener methods).

Support Managed-Bean support-bean session / application

Description: This type of bean "supports" one or more views in the "View" concern of the MVC design pattern. The typical use case is supplying an ArrayList<SelectItem> to JSF h:selectOneMenu drop-down lists that appear in more than one JSF view. If the data in the dropdown lists is particular to the user, then the bean would be kept in session scope. However, if the data applies to all users (such as a dropdown lists of provinces), then the bean would be kept in application scope, so that it can be cached for all users.

Utility Managed-Bean utility-bean application

Description: This type of bean provides some type of "utility" function to one or more JSF views. A good example of this might be a FileUpload bean that can be reused in multiple web applications.

 

 

分享到:
评论

相关推荐

    JSF2-Managed-Beans

    JSF 2.0: Managed Beans – Classes to Represent Form Info

    JSF入门文档(英文ppt)

    ...........\03-Managed-Beans.pdf ...........\04-Expression-Language.pdf ...........\05-Properties-Files.pdf ...........\06-Event-Handling.pdf ...........\07-HTML-Library.pdf ...........\08-...

    jsf实现登录功能

    这是一个使用jsf框架实现简易登录功能的小例子,对于初学者可以参考一下。

    cursojsf-managedbeans-escopos:由 Cássio Oliveira 教授的 IFPB Monteiro 扩展课程中使用的项目存储库,内容是使用 JavaEE、JSF 和 Primefaces 进行 Web 开发简介。 演示组件使用的项目

    由 Cássio Oliveira 教授的 IFPB Monteiro 扩展课程中使用的项目存储库,内容是使用 JavaEE、JSF 和 Primefaces 进行 Web 开发简介。 项目演示使用组件:inputText、outputLabel、commandButton、按钮和表单。 ...

    JSF基础教程 简体中文

    JSF 使用 Bean 来达到逻辑层与表现层分离的目的,Bean 的管理集中在组态档案中,您只要修改组态档案,就可以修改 Bean 之间的相依关系。 o Backing Beans o Beans 的组态与设定 o Beans 上的 List, Map 数据转换与...

    JSF入门教程

    jsf入门教程讲解了JSF入门,managed beans,数据转换与验证,事件处理

    javaee7-samples:JAVA EE 7 课程演示

    Managed Beans 1.0 - -- 网络服务规范 (删减)JAX-RPC 1.1 - - JAX-WS 2.2a - -项目-邮件列表 JAXB 2.2 - JSR 222 -项目-邮件列表 Web 服务 1.4 - JSR 109 Web 服务元数据 2.1 - JSR 181 JAX-RS 2.0 - JSR 339 -...

    JSF入门pdf

    2. Managed Beans 2.1 Backing Beans 2.2 Beans的配置与设定 2.3 Beans上的List, Map 3. 数据转换与验证 3.1 标准转换器 3.2自定义转换器 3.3标准验证器 3.4自定义验证器 3.5错误信息处理 3.6 自定义转换, 验证标签 ...

    JSF入门资料.pdf

    一个JSF的入门资料,包括managed beans,资料转换与验证,事件处理,JSF标签,自定义元件.

    JSF入门必看

    1.1 简介 JSF 1.2 第一个 JSF 程序 1.3 简单的导航 Navigation 1.4 导航规则设置 1.5 JSF Expression Language 1.6 国际化信息 2. Managed Beans

    The Definitive Guide to JSF in Java EE 8

    have happened years ago: the deprecation of the JSF managed bean facility in favor of using CDI beans. Other features are support for WebSocket using the Java EE WebSocket APIs donated by OmniFaces,...

    java server face 教程

    • Managed Beans JSF 使用 Bean 来达到逻辑层与表现层分离的目的,Bean 的管理集中在组态档 案中,您只要修改组态档案,就可以修改 Bean 之间的相依关系。 o Backing Beans o Beans 的组态与设定 o Beans 上的 List...

    Java EE 6 规范

    Java EE 6 规范包括EJB 3.1 •Servlet 3.0 •JSP 2.2 •EL 2.2 •JMS 1.1 •JTA 1.1 ...•Managed Beans 1.0 •Contexts and Dependency Injection for Java EE 1.0 •Dependency Injection for Java 1.0

    myfaces:Apache MyFaces核心

    2.3-next等于JSF 2.3 API,但将@ManagedBeans委托给CDI。 通过XML配置的ManagedBeans被完全忽略。 旧的FacesEL(javax.faces.el。*)的实现也已被完全删除。 这将是即将到来的JSF 4.0的基础。 2.3.x JavaServer ...

    javaee API

    javax.el Provides the API for the Unified Expression Language shared by the JSP 2.1 and JSF 1.2 technologies. javax.enterprise.deploy.model Provides Tool Vendor implementation classes. javax....

Global site tag (gtag.js) - Google Analytics