Using client side API for getting object ids

The client side tag library can be used in one interesting use case which is to get portletId and pageId of portlet where the portlet is getting rendered. In order to do that i built a simple portlet which forward control to JSP like this

</portlet-client-model:init>
<h4>Constants on page</h4>
<table>
<tr>
<td>Portlet Window Id</td>
<td><%=portletWindowID%></td>
</tr>
<tr>
<td>Portlet Page Id</td>
<td><%=portletPageID%></td>
</tr>

</table>


When i did that and added the portlet on a page i could see output like this



Now if i do export of the page where the portlet is added i can see output like this, as you can see the page id and portlet Ids that are getting displayed in the last screen shot

<content-node action="update" active="true" allportletsallowed="true" content-parentref="6_CGAH47L008IC40I4BOR2EO00I3" create-type="explicit" domain="rel" objectid="6_VVILMKG1084FA0IC6ARBEQ1000" ordinal="100" type="page">
<supported-markup markup="html" update="set"/>
<localedata locale="en">
<title>Hello World</title>
</localedata>
<parameter name="com.ibm.portal.IgnoreAccessControlInCaches" type="string" update="set"><![CDATA[false]]></parameter>
<parameter name="com.ibm.portal.bookmarkable" type="string" update="set"><![CDATA[Yes]]></parameter>
<parameter name="com.ibm.portal.remote-cache-expiry" type="string" update="set"><![CDATA[0]]></parameter>
<parameter name="com.ibm.portal.remote-cache-scope" type="string" update="set"><![CDATA[NON-SHARED]]></parameter>
<access-control externalized="false" owner="uid=wasadmin,o=defaultwimfilebasedrealm" private="false"/>
<component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_VVILMKG1084FA0IC6ARBEQ1004" ordinal="100" orientation="H" skinref="undefined" type="container" width="undefined">
<component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_VVILMKG1084FA0IC6ARBEQ1002" ordinal="100" orientation="V" skinref="undefined" type="container" width="undefined">
<component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_VVILMKG1003E90IC67N6VF30G0" ordinal="200" skinref="undefined" type="control" width="undefined">
<portletinstance action="update" domain="rel" objectid="5_VVILMKG1003E90IC67N6VF3007" portletref="3_VVILMKG1003E90IC67N6VF3006"/>
<portletinstance action="update" domain="cust" objectid="5_VVILMKG1003E90IC67N6VF30G4" owner="uid=wasadmin,o=defaultWIMFileBasedRealm" parentref="5_VVILMKG1003E90IC67N6VF3007" portletref="3_VVILMKG1003E90IC67N6VF3006"/>
</component>
</component>
</component>
</content-node>

1 comment: