|
Home > Archive > WebSphere Portal Server > April 2004 > How to get a page id from portlet?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to get a page id from portlet?
|
|
| bernar_l 2004-04-07, 5:34 am |
| Hi all,
I try to get from a portlet code, the page Id where the portlet is running.
Does someone know how to do it using the IBM portlet API?
Thxs
| |
| Oliver Meyer 2004-04-07, 6:41 am |
| Bernar,
the portlet does not know which page it is located on. Therefore, as far
as I know, this is not possible.
Oliver
bernar_l wrote:
>
> Hi all,
>
> I try to get from a portlet code, the page Id where the portlet is running.
> Does someone know how to do it using the IBM portlet API?
>
> Thxs
| |
| Michael Yashin 2004-04-11, 3:07 pm |
| Hi,
Yes you can do it. You should use Object Model v5 API. It is not
public available. Try asking IBM Support....
You should write something like this:
-------
import com.ibm.portal.*;
import com.ibm.portal.navigation.*;
import com.ibm.wps.model.ModelUtil;
ModelUtil util = ModelUtil.from(request)
NavigationNode node =
(NavigationNode)util.getNavigationSelectionModel().getSelectedNode();
//this gives you SYSTEM id of the page it MUST be
String id = node.getContentNode().getObjectID().toString();
//this gives you USER id of the page USUALLY it is not entered by
users 
String id2 = node.getContentNode().getObjectID().getUniqueName()
-------
Hope it helps.
Regards,
Michael Yashin
| |
| cburleso@us.ibm.com 2004-04-14, 2:10 pm |
| You can also get a unique identifyer for the portlet by using
String pid = portletResponse.encodeNamespace("");
|
|
|
|
|