Develop > Presentation layer > Customize marketing > Marketing customization: Management Center > Customizing customer segments > Add a new customer segment attribute to Management Center


Create 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.


Before you begin

Review the following topic to understand the format of the XML response that the server returns:


Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.

  2. Create a directory to store the 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 describes the lines with black numbered callouts:

    •  1  If the condition usage is "andListCondition", the serialization JSP file will map to the <wcfObjectTemplate 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 <wcfObjectTemplate 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 <wcfObjectTemplate 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 path="/SerializeCustomerSegment-conditionVariable_value" include="/jsp/your_company_name/marketing/name_of_serialization_jsp_file.jsp" />
    

    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 the new customer segment attribute in an earlier step of this procedure.

    Here is an example:

    <action path="/SerializeCustomerSegment-loyalty" include="/jsp/your_company_name/marketing/SerializeCustomerSegmentLoyaltyPoints.jsp" />
    

  8. Restart the WebSphere Commerce test server to make the new configuration available.


What to do next

After you complete the customization:

  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This is the default environment setting.

  2. Test the changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.

  3. Deploy your changes to the production environment.


+

Search Tips   |   Advanced Search