I want my component presentation to be personalized depending on a customer characteristic (customerType). We show different component presentations depending different customerType accessing to the page. customerType will come from java backend logic(as of now I am bringing from URL request parameters).
I am done with following steps:-
Create Target Group.
Add Target group with a component presentation on the page.
condition will be used by Tridion CD APIs. Published page has my Component Presentation wrapped with tag below :-
<div>
<tridion:TargetGroup itemURI="tcm:100-1000000-64">
<tridion:Conditions negate="false" operator="AND">
<tridion:Conditions negate="false" operator="OR">
<tridion:Conditions negate="false" operator="AND">
<tridion:Condition type="CustomerCharacteristic" operator="=" negate="false" name="customerType" value="1"/>
<tridion:Condition type="CustomerCharacteristic" operator="=" negate="false" name="customerType" value="0"/>
</tridion:Conditions>
</tridion:Conditions>
</tridion:Conditions>
<form:form action="****" method="post" commandName="**" id="location">
<input type="submit" value="AppLoc" id="AppLoc" style="display:none;" />
<div class="" role="main">
<table>
<tr>
<td >Branch</td>
<td ><div>abc</div></td>
</tr
</table>
</div>
</form:form>
</tridion:TargetGroup>
</div>
What I am able to find is CD API com.tridion.personalization and below is my code
<%@ page import="com.tridion.web.jsp.JSPPage,
com.tridion.personalization.CustomerCharacteristics,
com.tridion.user.User"%>
<%
JSPPage waiPage = new JSPPage(pageContext, "tcm:1-1-64");
CustomerCharacteristics customerCharacteristics = new CustomerCharacteristics(waiPage.getUser());
String custT = request.getParameter("customerType");
customerCharacteristics.setValue("customerType", custT);
customerCharacteristics.executeUpdate();
%>
<html>
<head></head><body>
<hr color="#000000" /> <center>
<h3><%="- " + customerCharacteristics.getValue("customerType")%> </h3>
<h3><%="---- :" + waiPage.getUser()%> </h3>
<div>
<!-- Below conditions updated ad per the suggestion provided by Bjørn van Dommelen -->
<tridion:TargetGroup itemURI="tcm:159-164141-64">
<tridion:Conditions negate="false" operator="AND">
<tridion:Condition type="CustomerCharacteristic" operator="=" negate="true" name="customerType" value="2"/>
</tridion:Conditions>
<div class="" role="main">
<table>
<tr>
<td >Branch</td>
<td ><div>abc</div></td>
</tr
</table>
</div>
</tridion:TargetGroup>
</div>
</center>
</body>
</html>`
I am getting my entries in CUSTOMER_CHARACTERISTICS and User table in Broker database. I think only think left now is condition.