You are here

Using multiple navigation models in a template in WebCenter 11g PS3

As a comment on the tutorial about the navigation model i got the question if it's possible to use multiple navigation models in a custom template.
WebCenter only supports a single default navigation model but you can access any navigation model from your template.

This post gives a short example how you can use multiple navigation models in WebCenter 11g PS3.

You can download the example project to take a closer look at the details.

The example contains an additional navigation model that contains links to search engines. I will modify the default template by adding the second navigation model.

I also added the additional template in the pagetemplates folder and is called multipleNMTemplate.
The most important lines are the ones between 99 and 113. These lines are responsible for displaying the navigation model.

First of all we will display the default navigation model:

  1. <af:panelGroupLayout id="pnlFirstNM" layout="horizontal">
  2. <c:forEach var="node" varStatus="vs"
  3.     items="#{navigationContext.currentModel.listModel['startNode=/, includeStartNode=false']}">
  4.    <af:goLink id="gLink"  destination="#{node.goLinkPrettyUrl}">
  5.           <span><b class=""><af:outputText value="#{node.title}"/></b></span>
  6.     </af:goLink>
  7. </c:forEach>
  8. <f:facet name="separator">
  9.    <af:spacer id="sp1" width="10px"/>
  10. </f:facet>
  11. </af:panelGroupLayout>

As you can see we can reference the default navigation model by calling navigationContext.currentModel. Don't think that this call will refer to the default-navigation-model.xml. In our case it does, but this is not always the case. If you would select the searchEngines as the default navigation model than this call will reference the searchEngines navigation model.

In the second part we will display the searchEngines navigation model by using a reference to its path:

  1. <af:panelGroupLayout id="pnlSecondNM" layout="horizontal">
  2. <c:forEach var="node" varStatus="vs"
  3.  items="#{navigationContext.navigationModel['/oracle/webcenter/portalapp/navigations/searchEngines'].listModel['startNode=/, includeStartNode=false']}">
  4.   <af:goLink id="gLink2" destination="#{node.goLinkPrettyUrl}">
  5.        <span><b class=""><af:outputText value="#{node.title}"/></b></span>
  6.    </af:goLink>
  7. </c:forEach>
  8. <f:facet name="separator"><af:spacer id="sp2" width="10px"/></f:facet>
  9. </af:panelGroupLayout>

As you can see, we can reference whatever navigation model we like by calling the navigationContext.navigationModel['pathToNavModel'].

That's it. Nothing more to it.
Now make the template available as a portal resource by right clicking on it in the Application Browser and select Create Portal Resource

Run the Portal project. Login with an administrator and go to the configuration so you can select the default template:

When you return to the portal you will notice that both the navigation models are rendered:

As you can see, this is not realy that difficult. You only need to know how to get the second navigation model by calling navigationContext.navigationModel[]. That's all.

WebCenter Tags: 


Hi, Yannick.

I've downloaded your example, it works very well.
It made me learn that why i do my own is not work.
when i create a navigation model i add a jspx page directly to it then it's not shown.
But when i add a links like yours it works correctly.
Can we add a jspx page directly to navigation model without using pageQuery?


Yes you can, however it is very important to know that you always need to add the page to the page hierarchy. If you don't add the page to the page hierarchy, it will not work.
The page hierarchy contains the security of your pages.
It's good practice to only use the page hierarchy for security and never use the page query in your navigation model.

So this is the basic workflow of adding a jspx page:
1) create the JSPX in your portal project
2) Add the JSPX to the page hierarchy and define security (delegate or inherit)
3) Add the JSXP to the navigation model as a link.

If you follow this, it should always work.

From you comment above i try to do it, it work.
I got a concept of navigation and pagehierarchy from them.
Thank you very much.

I have an issue with af:inlineframe

I want to embed the OPA screen inside the ADF page.
Like this,

The screen contains questionaries steps, for each step there is a submit button action.
On the submit button action the page goes out of the template, and opens the URL which I have embedded.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer