Code generated by portlet-client-model:init tags

Starting from version 6.1, WebSphere Portal server ships with client side API, that lets you do following things

  • Get and Set preferences

  • Change portlet modes and window states

  • Manipulate user profile



The Rational Application Server 7.5 provides you with tools to work with the client side API, You might have noticed that when you create a JSP inside portlet it includes these portlet-client-model tags

<portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>


If you look at the generated source code you will notice that the above JSP code generates following HTML code

<script>
if(typeof dojo=='undefined') {
document.writeln("<scr"+"ipt src='/wps/themes/dojo/portal_dojo/dojo/dojo.js' >
</scr"+"ipt>");
}
</script>
<script>
dojo.require('ibm.portal.xml.xpath');
dojo.require('ibm.portal.xml.xslt');
</script>
<script>
dojo.require('ibm.portal.portlet.portlet');
</script>
<script>
if(typeof(ibmPortalConfig) == "undefined") {
ibmPortalConfig = {contentHandlerURI: "/wps/mycontenthandler/!ut/p/digest!p3CnkU0nAEWw1oYE_wKYdg/nm/oid:wps.portal.root"};} else if(!ibmPortalConfig["contentHandlerURI"])
{ibmPortalConfig["contentHandlerURI"] = "/wps/mycontenthandler/!ut/p/digest!p3CnkU0nAEWw1oYE_wKYdg/nm/oid:wps.portal.root";} </script>
<div id='com.ibm.wps.web2.portlet.root.7_8000CB1A00QN00IC8BRUOG00O5' style='display: none;'>/wps/mycontenthandler/!ut/p/digest!p3CnkU0nAEWw1oYE_wKYdg/pm/oid:--portletwindowid--@oid:6_8000CB1A00QN00IC8BRUOG00O4</div>
<div id='com.ibm.wps.web2.portlet.preferences.7_8000CB1A00QN00IC8BRUOG00O5' style='display: none;' pageid='6_8000CB1A00QN00IC8BRUOG00O4' configid='3_8000CB1A00QN00IC8BRUOG0081' editdefaultsid='5_8000CB1A00QN00IC8BRUOG00O3'
editid='5_8000CB1A00QN00IC8BRUOG00O7'
>
</div>
<div id='com.ibm.wps.web2.portlet.user.7_8000CB1A00QN00IC8BRUOG00O5' style='display: none;'>/wps/mycontenthandler/!ut/p/digest!p3CnkU0nAEWw1oYE_wKYdg/um/secure/currentuser/profile?expandRefs=true</div>


As you can see the start of portlet-client-model:init tag is used for initializing the client side API on your page, it is checking if dojo is included on page already if not including it.

The call to portlet-client-model:require is getting converted into one or many dojo.require calls, the dojo.require is similar to import statement in the java it is used for importing classes into your code. In my case we are including classes from ibm.portal.xml and ibm.portal.portlet packages. In case of Dojo the dojo.require() call is used for including a .js file in your page.
The dojo classes are stored in the Wps.ear folder like this. You can create your custom classes and add theme to wps.ear



The portlet-client-model:init tag also generates some div tags that hold information required for client side API. For example the <div id='com.ibm.wps.web2.portlet.user.7_8000CB1A00QN00IC8BRUOG00O5' style='display: none;'>/wps/mycontenthandler/!ut/p/digest!p3CnkU0nAEWw1oYE_wKYdg/um/secure/currentuser/profile?expandRefs=true</div> holds information about how to load user profile information for current user.

3 comments:

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...

Egmedi.com 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