Backing bean and Managed bean are not different they are the same. Managed bean is about how the bean is created and initialized. Backing bean is about the role a particular managed bean plays.
In other way, Managed bean is a JavaBean registered in the adfc-config.xml file. These beans have properties that are bound to the values of UIComponents.
Backing bean is a special type of managed-bean consisting of properties that are UIComponents. Instead of the bean properties being bound to the UIComponent values, they are instead bound to the UIComponents themselves.
3,上面2中介绍的两种方法是在Fusion web application中的;也可以在faces-config.xml中定义Managed(Backing) bean,这也被Oracle称作standard JSF application。
Managed(Backing) bean被定义在哪个文件里,ADF会有不同的处理:
Managed Bean Placement
Effect
adfc-config.xml(无边界Task Flow)
Managed bean can be of any scope. However, any backing beans for page fragments or declarative components should use BackingBean scope.
When executing within an unbounded task flow, faces-config.xml will be checked for managed bean definitions before the adfc-config.xml file.
Lookup precedence is enforced per scope. Request-scoped managed beans take precedence over session-scoped managed beans. Therefore, a request-scoped managed bean named foo in the adfc-config.xml file will take precedence over a session-scoped managed bean named foo in the current task flow definition file.
Already instantiated beans take precedence over new instances being instantiated. Therefore, an existing session-scoped managed bean named foo will always take precedence over a request-scoped bean named foo defined in the current task flow definition file.
Task flow definition file(有边界Task Flow)
Managed bean can be of any scope. However, managed beans of request scope, of pageFlow scope, of view scope, or with the scope set to none that are to be accessed within the task flow definition must be defined within the task flow definition file. Any backing beans for page fragments in a task flow should use BackingBean scope. Managed bean definitions within task flow definition files will be visible only to activities executing within the same task flow.
When executing within a bounded task flow, faces-config.xml will be checked for managed bean definitions before the currently executing task flow definition. If no match is found in either location, adfc-config.xml and other bootstrap configuration files will be consulted. However, this lookup in other adfc-config.xml and bootstrap configuration files will only occur for session- or application-scoped managed beans.
Lookup precedence is enforced per scope. Request-scoped managed beans take precedence over session-scoped managed beans. Therefore, a request-scoped managed bean named foo in the adfc-config.xml file will take precedence over a session-scoped managed bean named foo in the current task flow definition file.
Already instantiated beans take precedence over new instances being instantiated. Therefore, an existing session-scoped managed bean named foo will always take precedence over a request-scoped bean named foo registered in the current task flow definition file.
Customizations are allowed.
faces-config.xml
Managed beans can be of any scope other than pageFlow scope or view scope.
When searching for any managed bean, the faces-config.xml file is always consulted first. Other configuration files will be searched only if a match is not found. Therefore, beans registered in the faces-config.xml file will always win any naming conflict resolution.
No customizations can be made.
4,在ADF中使用Manage(Backing) bean的best practice
Use managed beans to store logic that is related to the UI rendering only. All application data and processing should be handled by logic in the business layer of the application. Similar to how you store data-related logic in the database using PL/SQL rather than a Java class, the rule of thumb in a Fusion web application is to store business-related logic in the middle tier. This way, you can expose this logic as business service methods, which can then become accessible to the ADF Model layer and be available for data binding.