Sample code for working with User Profiles on the clent side

<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%><%@taglib
uri="http://java.sun.com/portlet" prefix="portlet"%><%@taglib
uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model"
prefix="portlet-client-model"%><%@taglib
uri="http://java.sun.com/portlet" prefix="portletx"%><portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>
<portlet:defineObjects />
<p>User Profile Sample</p>
<script>
_portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");
function handleUserProfile(portletWindow, status, userProfile){
console.log("Inside handleUserProfile");
console.log(userProfile);
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
// This is sample of how to get attributes from User Profile
console.log("Preferences.getValue()\n"+ userProfile.getAttribute("uid"));
//Follow these two steps to set attribute
userProfile.setAttribute("displayName","Sunil Patil");
_portletWindow.setUserProfile(userProfile);
}
else {
console.log("error loading feed");
}
}
_portletWindow.getUserProfile(handleUserProfile);
</script>

You can download this sample from here

2 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