Lotus WCM Personalization Component Retrieving Results based on current SiteArea - Personalization Componet with current sitearea

There are scenarios where same personalization component should behave or display results based on the current SiteArea context.

I have couple of Portal pages with News portlet on it (Web content viewer portlet pointing to different news siteareas), I mean Web Content Viewer portlet on the HR page is pointing to HR news ...etc.

Following is one way you can pass the current sitearea context to personalization component.

1. Create JSP component to retrieve the current rendering sitearea path
2. Create Personalization component that uses the sitearea path
3. Create Presentation Template to refer to JSP component and Personalization Component

Step 1: Create JSP component with following code to retrieve the  current sitearea path

<%@ taglib uri="/WEB-INF/tld/wcm.tld" prefix="wcm" %>
<%@ page import="com.ibm.workplace.wcm.api.*" %>

<!--<wcm:initworkspace user="<%=(java.security.Principal)request.getUserPrincipal()%>">Cannot get Workspace</wcm:initworkspace>-->
<wcm:initworkspace username="wpsadmin" password="wpsadmin" >Cannot get Workspace</wcm:initworkspace>
<%RenderingContext context = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);

Step 2: Create Personalization component and write rule for that component as below

Select Web Content
  whose  Location  is  current Request.sitePath  and
  whose  Authoring Template  is  library/AT_News

NOTE: You need to create the dynamic request attribute named "sitePath" while creating this rule.

<div class="news_links">

Design for each menu search result:
<a href='<Placeholder tag="href"/>'><IDCmpnt context="autoFill" type="content" field="title"/></a>
<IDCmpnt context="autoFill" type="content" field="description"/>
<br><WorkflowCmpnt context="autoFill" type="content" field="publishdate" format="MMMM dd, yyyy"/> 



Step 3: Create Presenation Template with following design code to display the personalization component output.
<component name="library/JSP_testPZNComponent"/>
<component name="library/PERS_testPersComponent"/>

Step 4: Add the WCM content viewer portlets on different pages with different sitearea selected. (have pages with WCM mappings done with different sitearea)

by navigating to different pages ,  PZN rule should read the contents from siteareas configured (or mapped) and displays the corresponding news.


  1. This doesn't work if you are using the JSR286 local rendering portlet because the request context in that portlet is not shared with the PZN engine. The only way that I have found to do it is to use the DynaCache as a bridge for making runtime attributes visible to the PZN engine.

    1. Hi Siva,
      It seems like Cody Burleson is right PZN component is not working like this I am trying to fetch the content using a PZN component in JSP Component by providing dynamic category as request parameter. He said he used Dynacache as a bridge I am not sure how and what he meant by this. I you have any idea please if you could explain a bit. I am using Portal 8

    2. Looks like I missed few details in this article , But it should work fine at least for the use case I have tested or developed initially was working fine.

      Updating above article with more details and let me know if this helps.