Building a hybrid application with Mobile Application Framework and WebCenter Portal


With the release of the Mobile Application Framework it makes sense to look into building a hybrid application that integrates assets from WebCenter into a native application. This will reduce the development cost (build once, reuse multiple times) and simplifies management.
WebCenter Portal provides functionality to target specific pages to specific mobile devices. By doing so, we can build pages that are designed to be consumed in a native application.
By doing so, you can build your entire mobile application in WebCenter Portal but still make use of the native features provided by the mobile framework.
It also allows you to reuse the assets and no redevelopment is required.

In this blog post I will show what steps are required to build a hybrid application in both WebCenter Portal and a mobile application.

Main Article

In order to build a hybrid application we need to complete a few steps:

1) Building a template in WebCenter Portal that will be used to display our pages for native integration
2) Build a custom component in your mobile application to consume WebCenter pages
3) Add the custom component to an AMX page

Each of these steps will be described in detail below.

In addition to this I will also briefly explain how to reuse the navigation model from WebCenter to build a dynamic navigation in your mobile application.

Build a page template in WebCenter Portal

Because we are relying on the mobile application to display the page, we have to build a clean template in WebCenter portal that does not contain anything except for the content facet.
A simple template like that will look like this:

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1" xmlns:wcshell="" xmlns:f="" xmlns:af="" xmlns:wcdc="" xmlns:cust="" xmlns:trh="" xmlns:rtc="">
   <af:pageTemplateDef var="attrs">
         <component xmlns="">
               <default-value>#{not empty WCAppContext.currentPageTemplate.attributesMap['templateFixedWidth'].value ? WCAppContext.currentPageTemplate.attributesMap['templateFixedWidth'].value : '1000'}</default-value>
               <default-value>#{not empty WCAppContext.currentPageTemplate.attributesMap['topPanelHeight'].value ? WCAppContext.currentPageTemplate.attributesMap['topPanelHeight'].value : '44'}</default-value>
               <default-value>#{not empty WCAppContext.currentPageTemplate.attributesMap['panelSeparatorHeight'].value ? WCAppContext.currentPageTemplate.attributesMap['panelSeparatorHeight'].value : '14'}</default-value>
               <default-value>#{not empty WCAppContext.currentPageTemplate.attributesMap['brandingImageUrl'].value ? WCAppContext.currentPageTemplate.attributesMap['brandingImageUrl'].value : ''}</default-value>
               <default-value>#{empty WCAppContext.currentPageTemplate.attributesMap['footerNavigationFile'].value ? '' :
                                'modelPath='}#{empty WCAppContext.currentPageTemplate.attributesMap['footerNavigationFile'].value ? '' :
      <af:panelGroupLayout id="pt_pgl3" layout="scroll" styleClass="WCSiteTemplateRoot">
         <af:panelGroupLayout id="pt_pgl5" layout="vertical" styleClass="WCSiteTemplateBackground">
            <af:panelGroupLayout id="pt_pbl1" layout="vertical" inlineStyle="width:#{attrs.templateFixedWidth}px;margin:0px auto;padding-top:8px;">
               <af:panelGroupLayout id="pt_pglc" layout="vertical" inlineStyle="min-height:600px;padding:#{attrs.panelSeparatorHeight}px 0px 12px;" styleClass="WCContent">
                  <af:region value="#{bindings.spacesNavigationPageHeader.regionModel}" id="wcSpcInd"/>
                  <af:facetRef facetName="content"/>

As you can see the actual content of the template is very small. It only acts as a container for the content facet.
This is because in the native application, we want to use our own template.

If of course, you want to reuse a template from WebCenter, you can do so as well but later on in this post you will see that a WebCenter page will only be a part of native app page and we don’t want the WebCenter template to interfere with the native template.

Once you have such a template, you can assign it to be the template for your mobile devices. In order to do so you need to go the administration of your portal and select Device Settings:


Once this is done you can start creating page variants for the devices you have the mobile template assigned to.

After this, the work can start on the mobile application.

Creating a custom component in MAF

The mobile application framework is based upon HTML5 and Javascript. It has been designed in a way that developers can easily create their own components and use them in a native application. These components are build using JavaScript and we can inject HTML into our native application.
With this approach we can build a custom component that renders an iframe in our native application

The custom component also allows us to specify the source for the iframe and the height. This way we can reuse the component in several places.

More information about building custom components can be found here:

The JS for this custom component looks like this:

    var wcpEmbed ="", "wcpEmbed");
    wcpEmbed.prototype.render = function(amxNode, id)
      var rootElement = document.createElement("div");
      var source = amxNode.getAttribute("source");
      var height = amxNode.getAttribute("height");
      rootElement.innerHTML = "<iframe width='100%' id='f1' height='"+height+"' src='"+source+"'/>";
      return rootElement;
      alert("Problem ");

When we have the javascript for our custom component we need to register it with our feature before using it:


After we can register our custom component with our AMX page:

<amx:view xmlns:xsi="" xmlns:amx=""

Notice that the URL for our namespace matches the URL we provide in the register method in our custom component javascript:

var wcpEmbed ="", "wcpEmbed");

Now that we have registered the component we can use it in the AMX page using the wcpEmbed component:

<?xml version="1.0" encoding="UTF-8" ?>
<amx:view xmlns:xsi="" xmlns:amx=""
  <amx:panelPage id="pp1" styleClass="AFStretchWidth">
    <amx:facet name="header">
      <amx:outputText value="Hybrid App" id="ot1"/>
    <amx:facet name="secondary">
      <amx:commandButton shortDesc="back" text="&lt;" action="back" id="cb1"/>
    <wcp:wcpEmbed id="em1" height="500px" source="#{viewScope.urlBean.prettyUrl}"/>

When building mobile pages in WebCenter it is always a good practice to build an adaptive or responsive design.
You always have to remind that devices vary in size and people can reorient their device. Because of this some careful considerations need to be taken when designing those pages.


Reusing WebCenter Portal navigation model for dynamic navigation

Inside your mobile application you can even reuse the navigation model from WebCenter to build a dynamic navigation.
By using the WebCenter Portal REST API you can have access to the navigation model.

In WebCenter you can also decide about the default behavior for pages that don’t have a page variant for the requesting device.
This can be done in Device page fallback section of the page summary:


In order for this to work you also have to add the agent parameter to the header because if you call a REST API, ADF will not add the header to the request. This needs to be done manually. If you omit that parameter from the header, WebCenter will assume desktop and return all the pages.

Consuming a REST API has been made easy with the Mobile Persistence Extension for MAF:
This framework allows you to easily create a data control based upon the REST endpoint.

More information on the navigation REST API for WebCenter Portal can be found here:




  1. vinay kumar says:

    Hi Yannick,

    I am still trying to understand this, what is benefit of this design. Only to use portal asset in mobile device. If we want to use
    device capability like accessing contact from portal application,then it will be accessible through MAF?

    MAF app just showing portal page or something else? advantage of this design?

  2. Jigisha Koiker says:

    Would it be possible to trigger workflow approvals using this framework ?

  3. Matt Gunter says:

    What versions of Webcenter and MAF were you using here?

  4. Barry Hiern says:

    Would be interested to know why you chose to use a custom component in an AMX page to expose the remote WebCenter page rather than simply exposing it using “Remote Page” content in the feature? (part of the page rather than the whole page?)

    I assume that you would need to “white-list” the URL that is being accessed from the component.



    • The reason why a custom component is better in this case is that a remote page is not easily customizable.
      For example if you have a springboard or custom navigation and the integrated page need to be fit in than you cannot achieve this with a remote page. Remote pages don’t care about templating.
      Because of this, a custom component provides the most flexible and seamless integration.

Add Your Comment