Creating and registering a serialization JSP file for the customer segment attribute

Create and register a serialization JSP file to take the authoring elements from the MGPCONDELE table on the server and display them in the Management Center user interface. Business users can then set the properties for the customer segment attribute in the Marketing tool. The serialization JSP file is responsible for both the OR/AND list condition as well as the simple condition.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a directory to store your new JSP file.
    Use a directory structure similar to the following example:

    LOBTools/WebContent/jsp/your_company_name/marketing

  3. Create a JSP file with this syntax: SerializeCustomerSegmentattribute_name.jsp, for example, SerializeCustomerSegmentLoyaltyPoints.jsp.
  4. Define the new serialization JSP file.
    The following is a sample serialization JSP file:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    
    <c:set var="objectType" value="LoyaltyPointsCondition"/> 
    <c:set var="parent" value="${element.parentElementIdentifier.name}"/>
    
    <c:if test="${empty element.simpleConditionVariable}">
    	<c:set var="objectType" value="LoyaltyPointsList"/> 
    	<c:set var="parent" value="LoyaltyPoints"/> 
    
    	<c:forEach var="searchElement" items="${allElements}">
    		<c:if test="${searchElement.parentElementIdentifier.name == element.memberGroupConditionElementIdentifier.name}">
    			<c:set var="foundChild" value="${searchElement}"/>
    		</c:if>
    	</c:forEach>
    
    	<c:choose>
    		<c:when test="${element.conditionUsage == 'andListCondition'}"> 1
    			<c:set var="template" value="between"/>
    		</c:when>
    		<c:when test="${foundChild.simpleConditionOperator == '>='}"> 2
    			<c:set var="template" value="greaterThan"/>
    		</c:when>
    		<c:when test="${foundChild.simpleConditionOperator == '<='}"> 3
    			<c:set var="template" value="lessThan"/>
    		</c:when>
    		<c:otherwise>
    			<c:set var="template" value="ignore"/>
    		</c:otherwise>
    	</c:choose>
    
    	<object objectType="${parent}">
    		<parent>
    			<object objectId="${element.parentElementIdentifier.name}"/>
    		</parent>
    		<elementName>${parent}</elementName>
    		<template>${template}</template>
    	</object>
    </c:if>
    
    <object objectType="${objectType}">
    	<parent>
    		<object objectId="${parent}"/>
    	</parent>
    	<elementName><![CDATA[${element.memberGroupConditionElementIdentifier.name}]]></elementName>
    	<conditionUniqueId><![CDATA[${element.memberGroupConditionElementIdentifier.uniqueID}]]></conditionUniqueId>
    	<conditionVariable><![CDATA[${element.simpleConditionVariable}]]></conditionVariable>
    	<conditionOperator><![CDATA[${element.simpleConditionOperator}]]></conditionOperator>
    	<conditionValue><![CDATA[${element.simpleConditionValue}]]></conditionValue>
    	<conditionUsage><![CDATA[${element.conditionUsage}]]></conditionUsage>
    	<conditionNegate><![CDATA[${element.negate}]]></conditionNegate>
    </object>
    The following table describes the lines with black numbered callout labels.
    Option Description
    1
    • If the condition usage is "andListCondition", the serialization JSP file will map to the <ObjectTemplate templateType="between"> template type, where the loyalty points condition has a range of values (minimum and maximum value).
    2
    • If the condition operator is "<=", the serialization JSP file will map to the <ObjectTemplate templateType="lessThan"> template type, where the loyalty points condition has a single loyalty point value.
    3
    • If the condition operator is ">=", the serialization JSP file will map to the <ObjectTemplate templateType="greaterThan"> template type, where the loyalty points condition has a single loyalty point value.

    To see other examples of serialization JSP files, review a default serialization JSP file for a similar customer segment attribute. The default files are named SerializeCustomerSegmentattribute_name.jsp, for example, SerializeCustomerSegmentCurrentAge.jsp. The default files are stored at this path:

    LOBTools/WebContent/jsp/commerce/marketing/restricted/

  5. Save and close the new serialization JSP file.
  6. Open the Struts configuration file, struts-extension.xml.
    The file is stored at this path:

    LOBTools/WebContent/WEB-INF

  7. Add a new action mapping to register the serialization JSP file:
    <action name="SerializeCustomerSegment-conditionVariable_value">
    <result name="SerializeCustomerSegment-conditionVariable_value">
    <param name="location">/jsp/your_company_name/marketing/name_of_serialization_jsp_file.jsp</param>
    </result>
    </action>

    where

    • conditionVariable_value is the value of the objectType attribute defined in the object definition for this customer segment attribute
    • name_of_serialization_jsp_file is the name you gave to the custom serialization JSP file for your new customer segment attribute in an earlier step of this procedure.

    Here is an example:

    <action name="SerializeCustomerSegment-loyalty">
    <result name="SerializeCustomerSegment-loyalty">
    <param name="location">/jsp/your_company_name/marketing/SerializeCustomerSegmentLoyaltyPoints.jsp</param>
    </result>
    </action>
  8. Restart the HCL Commerce test server to make the new configuration available.