How to get Portlet Window ID

You can get WindowId of the portlet inside your portlet using request.getWindowID() method. This method was introduced in the JSR 286.

System.out.println("Portlet Window Id -> " +request.getWindowID());
System.out.println("Portlet Name Space -> " +response.getNamespace());

I tried printing the following two values in the System.out and this is what i get

Portlet Window Id -> 7_VVILMKG100N080IA0G757C00O3
Portlet Name Space -> ns_7_VVILMKG100N080IA0G757C00O3_

As you can see the name space is nothing but ns_portletwindowid_

If export page definition this is what you will get, as you can see the portletWindowId is nothing but objectId of the control element that holds this portlet

<?xml version="1.0" encoding="UTF-8"?>

<request xmlns:xsi="" build="wp6103_201_01" type="update" version=""
<portal action="locate">
<web-app action="locate" domain="rel" objectid="1_VVILMKG100N080IA0G757C0000" uid="ServletPopup.war.webmod">
<servlet action="locate" domain="rel" name="ServletPopup" objectid="V_VVILMKG100N080IA0G757C0002"/>
<portlet-app action="locate" domain="rel" name="Application Name not available for this Application" objectid="2_VVILMKG100N080IA0G757C0004"
<portlet action="locate" domain="rel" name="ServletPopup" objectid="3_VVILMKG100N080IA0G757C0006"/>
<content-node action="locate" domain="rel" objectid="6_000000000000000000000000A0" uniquename="wps.content.root"/>
<content-node action="locate" domain="rel" objectid="6_CGAH47L008IC40I4BOR2EO00I3" uniquename="ibm.portal.Home"/>
<content-node action="locate" domain="rel" objectid="6_VVILMKG10GUS50I24V0O5Q2002"/>
<content-node action="locate" domain="rel" objectid="6_VVILMKG100OPD0II63CET20007"/>
<content-node action="update" active="true" allportletsallowed="true" content-parentref="6_VVILMKG100OPD0II63CET20007" create-type="explicit"
domain="rel" objectid="6_VVILMKG108SFA0IIDM2Q113007" ordinal="100" type="page">
<supported-markup markup="html" update="set"/>
<localedata locale="en">
<title>Popup Client Portlet</title>
<parameter name="" type="string" update="set"><![CDATA[false]]></parameter>
<parameter name="" type="string" update="set"><![CDATA[Yes]]></parameter>
<parameter name="" type="string" update="set"><![CDATA[0]]></parameter>
<parameter name="" 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_VVILMKG108SFA0IIDM2Q1130G0"
ordinal="100" orientation="H" skinref="undefined" type="container" width="undefined">
<component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_VVILMKG108SFA0IIDM2Q1130G4"
ordinal="100" orientation="V" skinref="undefined" type="container" width="undefined">
<component action="update" active="true" deletable="undefined" domain="rel" modifiable="undefined" objectid="7_VVILMKG100N080IA0G757C00O3"
ordinal="100" skinref="undefined" type="control" width="undefined">
<portletinstance action="update" domain="rel" objectid="5_VVILMKG100N080IA0G757C00O7" portletref="3_VVILMKG100N080IA0G757C0006"/>
<status element="all" result="ok"/>


srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said... is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery

Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store