Creating URLs to Components
You may want to create links between portal components by putting the URL of a portal component in a hyperlink tag (<a>). The Portal Runtime includes an API for creating URLs to portal components.

Never hardcode URLs. Always use the API to create the URLs.
...
1. Create a IPortalComponentURI object from the request object. This object is a helper class in creating the URL.
IPortalComponentURI componentURI = request.createPortalComponentURI();
2. Set the name of the component. In the example below, the link is to the portal component myApplication.myComponent.
componentURI.setContextName("myApplication" + "." + "myComponent");
3. Set the request event, if necessary.
IPortalRequestEvent myRequestEvent = request.createRequestEvent("myEvent");
componentURI.setPortalRequestEvent(myRequestEvent);
You can add parameters in the request by adding an IPortalRequestEventData object – which contains key-value pairs – to the IPortalRequestEventobject.
4. Set the target of the request event, if necessary. In the example below, the target is the current component.
componentURI.setTargetNode(request.getNode());
5. Set the mode, if necessary.
componentURI.setNodeMode(NodeMode.EDIT_MODE);
6. Create the URL string with the following:
componentURI.toString();