Triggering Navigation
The following describes the methods for creating links to other navigation nodes:
Navigation Tag Library (JSP)
The navigation tag library provides access to navigation nodes and can create navigation links from them.
For example, the following exposes the navigation nodeROLES://portal_content/myRole/myIViewand creates a link for navigating to the node:
<nav:navNode navTarget="ROLES://portal_content/myRole/myIView">
<nav:navNodeAnchor navigationMethod="byURL" urlParameters="<%=urlParameters%>" anchorAttributes="class='myCSSstyle'"/>
</nav:navNode>
The tag library is for portal components built from a JSP page.
For more information, see Navigation Tag Library .
Client-Side Eventing (EPCM)
The portal’s client-side eventing mechanism (EPCM) provides a JavaScript function for navigating to a specific navigation node.
The following creates a link for navigating to theROLES://portal_content/myRole/myIViewnode:
<A HREF="myLink"
onclick="return EPCM.doNavigate
('ROLES://portal_content/myRole/myIView')">
This is an HTML Link
</A>
For more information, see Client-Side Eventing
Instead of writing the code for theEPCM.doNavigatecall, you can get the code by callingNavigationEventsHelper.addClickEvent(), which creates the code and stores it as aStringBufferin one of the function’s parameter, as shown in the following:
importcom.sapportals.htmlb.Link;
importcom.sapportals.portal.navigation.NavigationEventsHelper;;
importcom.sapportals.portal.navigation.NavigationEventsHelperService;
NavigationEventsHelperServiceservice=(NavigationEventsHelperService) PortalRuntime.getRuntimeResources().getService( NavigationEventsHelperService.KEY);
NavigationEventsHelperhelper= service.getNavigationEventsHelperInstance();
INavigationNodecurrNode=service.getCurrentContextNavNode(request);
LinktitleLink=newLink( currNode.getName(),currNode.getTitle(request.getLocale()));
StringBufferscriptTarget=newStringBuffer();
helper.addClickEvent( currNode,scriptTarget,request,falsenull);
titleLink.setReference("javascript:void(0)");
titleLink.setOnClientClick(scriptTarget.toString());
titleLink.setLinkDesign(LinkDesign.DRAGRELATE);
Portal Runtime Link (PRT)
You can create a link to a specific portal component instead of to a node in the navigation hierarchy. Use the PRT API to create a link, as follows:
IPortalComponentURIcomponentURI=request.createPortalComponentURI();
componentURI.setContextName("myApplication.myComponent" );
myUrl=componentURI.toString();
Embed themyURLstring in an HTML anchor tag.
For more information on this API, see Request URL .