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/mycompany/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"%>
    <%@ taglib uri="http://commerce.ibm.com/foundation" prefix="wcf"%>
    
    <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'}">
    			<c:set var="template" value="between"/>
    		</c:when>
    		<c:when test="${foundChild.simpleConditionOperator == '>='}">
    			<c:set var="template" value="greaterThan"/>
    		</c:when>
    		<c:when test="${foundChild.simpleConditionOperator == '<='}">
    			<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><wcf:cdata data="${element.memberGroupConditionElementIdentifier.name}"/></elementName>
    	<conditionUniqueId><wcf:cdata data="${element.memberGroupConditionElementIdentifier.uniqueID}"/></conditionUniqueId>
    	<conditionVariable><wcf:cdata data="${element.simpleConditionVariable}"/></conditionVariable>
    	<conditionOperator><wcf:cdata data="${element.simpleConditionOperator}"/></conditionOperator>
    	<conditionValue><wcf:cdata data="${element.simpleConditionValue}"/></conditionValue>
    	<conditionUsage><wcf:cdata data="${element.conditionUsage}"/></conditionUsage>
    	<conditionNegate><wcf:cdata data="${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 Spring extensions configuration file, spring-extension.xml.
    The file is stored at this path:

    LOBTools/WebContent/WEB-INF

  7. Add a new spring bean definition 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>

    Here is an example:

    <bean id="/SerializeCustomerSegment-loyalty" class="org.springframework.web.servlet.mvc.ParameterizableViewController"> 
        <property name="viewName" value="/jsp/mycompany/marketing/SerializeCustomerSegmentLoyaltyPoints.jsp"/>
        <property name="supportedMethods" value="GET,POST"/> 
    </bean>
  8. Restart the HCL Commerce test server to make the new configuration available.