Tuesday, November 8, 2011

Changing a navigation model on a page in WebCenter

WebCenter has a default navigation model (menu) which is located in the navigations folder and is defined as portal preference in the adf-config.xml file. But this menu is used in every page of the portal. I want to change this, so when you are not authenticated you will see the normal website links. But when you go to the internal page the menu will be switched to the application navigation model.
Special thanks for Maiko Rocha of the WebCenter A-Team for helping me solving this requirement.

First I create a new jspx page based on the global template called Internal.jspx and add a navigation reference to this page in the default-navigation-model.xml.

Now we can create a navigation model which will be used in the internal page. This menu has a link to the home page so the user can go back to the default menu.

Open the global template called pageTemplate_globe.jspx and go the menu part.  Here we will change the default navigation model.

#{navigationContext.defaultNavigationModel.listModel['startNode=/, includeStartNode=false']}

#{navigationContext.navigationModel[ ]                                  .listModel['startNode=/, includeStartNode=false']}

Where menuSwitcher is a request bean.

To determine what navigation model I need to use I will check the current page and return the right navigation reference.

The request bean

You can also use EL instead of a request bean.

<af:forEach var="node" varStatus="vs"
          controllerContext.currentViewPort.viewId eq '/oracle/webcenter/portalapp/pages/Internal.jspx' ? 
             '/oracle/webcenter/portalapp/navigations/navigationModelInternal.xml'  : 
   ].listModel['startNode=/, includeStartNode=false']}">

Here some pictures of the home page

After being authenticated, some extra menu links appears

And at last, the internal page with the new navigation model.


  1. Very Nice Post


    1. How can we change the default node to display when the user hits the application URL ? For eg: From the last screenshot above, OTN should be the default one selected link and its corresponding page will be displayed without the user clicks on the link.