Using Managed Beans with your ADF Mobile Client Applications
Posted
by [email protected]
on Oracle Blogs
See other posts from Oracle Blogs
or by [email protected]
Published on Mon, 03 May 2010 17:45:44 +0000
Indexed on
2010/05/03
19:38 UTC
Read the original article
Hit count: 490
Did you know it's easy to extend your ADF Mobile Client application with a Managed Bean just like it is with an ADF web application? Here's how:
- Using the New Gallery (File -> New), create a new Java class. This class should extend oracle.adfnmc.el.utils.BeanResolver.
- Add this java class as a managed bean: Go to your task flow, select the Overview tab at the bottom and go to the Managed Bean section. Add an entry and name your new Managed Bean and point to the java class you just created.
- Add your custom methods and properties to your java class
- Since reflection is not supported in the J2ME version on some platforms (BlackBerry), you need to provide dispatch code if you want to invoke/access any of your methods/properties from EL. Here's a sample: MyBeanClass.java
- Use Expression Language (EL) to access your properties and invoke your methods on your MCX pages. Here's an sample:
<?xml version="1.0" encoding="UTF-8" ?>
<amc:view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:amc="http://xmlns.oracle.com/jdev/amc">
<amc:form id="form0">
<amc:menuControl refId="menu0"/>
<amc:panelGroupLayout id="panelGroupLayout1" width="100%">
<amc:panelGroupLayout id="panelGroupLayout2" layout="horizontal"
width="100%">
<amc:image id="image1" source="logo_sm.png"/>
<amc:outputText value="Home" id="outputText1" verticalAlign="center"
fontSize="20" fontWeight="bold"
foregroundColor="#ff0000"/>
</amc:panelGroupLayout>
<amc:commandLink text="#{MyBean.property1}" id="commandLink1"
actionListener="#{MyBean.doFoo}"
foregroundColor="#0000ff" action="patientlist"/>
</amc:panelGroupLayout>
</amc:form>
<amc:menu type="main" id="menu0">
<amc:menuGroup id="menuGroup1">
<amc:commandMenuItem id="commandMenuItem1" action="exit" label="Exit"
index="1" weight="0"/>
</amc:menuGroup>
</amc:menu>
</amc:view>
© Oracle Blogs or respective owner