A while back i was trying to implement programmatic portal navigation from this blog. While its a good proof of concept, it didnt work for my requirement. After some hit and trial, i saw the default globeTemplate which gave me a very simple idea on how to execute a declarative portal navigation.
This only works for commandLink but an equivalent structure can be constructed for goLinks as well. Here is how it goes:
For any commandLink to do a portal navigation, it needs 3 things:
1. actionlisnener should call #{navigationContext.processAction}
2. action should point to "pprnav"
3. Link should have a f:attribute with "node" as the name and a reference to a SiteStructure object in the value field.
You can refer to a specific node in a navigation model with this syntax:
#{navigationContext.navigationModel['/oracle/webcenter/portalapp/navigations/application_navigation_model.xml'].listModel['startNode=/, includeStartNode=false, depth=1'][1]}

where application_navigation_model is the navigation model where the desired node is present as the second node. The highlighted index is the index of the nodes with a starting index of 0.
This commandLink when clicked will cause a portal navigation to the "Docs n Downloads" node.
Special case : Navigation from within taskflows:
Often, most of the links in a portal are in adf regions in specific taskflow. In this case, things change a bit. The settings for f:attribute and actionListener remains the same. However, the action parameter changes. Remember, to execute a portal navigation, a "pprnav" action has to be invoked on the main page. Now since we are inside a region, the action has to be propagated to the main page.
For this use a parent action with parentOutcome=pprnav in your taskflow. Have your links action to this parent action inside the taskflow.
Hope this helps!
This only works for commandLink but an equivalent structure can be constructed for goLinks as well. Here is how it goes:
For any commandLink to do a portal navigation, it needs 3 things:
1. actionlisnener should call #{navigationContext.processAction}
2. action should point to "pprnav"
3. Link should have a f:attribute with "node" as the name and a reference to a SiteStructure object in the value field.
<af:commandLink id="pt_cl1" text="#{node.title}"
action="pprnav"
actionListener="#{navigationContext.processAction}">
<f:attribute name="node" value="#{node}"/>
</af:commandLink>
You can refer to a specific node in a navigation model with this syntax:
#{navigationContext.navigationModel['/oracle/webcenter/portalapp/navigations/application_navigation_model.xml'].listModel['startNode=/, includeStartNode=false, depth=1'][1]}
where application_navigation_model is the navigation model where the desired node is present as the second node. The highlighted index is the index of the nodes with a starting index of 0.
This commandLink when clicked will cause a portal navigation to the "Docs n Downloads" node.
Special case : Navigation from within taskflows:
Often, most of the links in a portal are in adf regions in specific taskflow. In this case, things change a bit. The settings for f:attribute and actionListener remains the same. However, the action parameter changes. Remember, to execute a portal navigation, a "pprnav" action has to be invoked on the main page. Now since we are inside a region, the action has to be propagated to the main page.
For this use a parent action with parentOutcome=pprnav in your taskflow. Have your links action to this parent action inside the taskflow.
Hope this helps!
Add a comment