Creating and registering a serialization JSP file for the campaign element

Create and register a serialization JSP file to take the authoring elements from the DMELEMENT and DMELEMENTNVP tables for your new campaign element and display them in the Management Center user interface. Business users can then set the properties for the campaign element in marketing activities.

About this task

When a business user opens an activity, the parent serialization JSP file, GetActivityChildren.jsp, calls the serialization JSP file for each campaign element to load the data for the activity.

If the object definition for your new campaign element includes wcfChildObjectDefinitions or wcfReferenceObjectDefinitions, you must create a new serialization JSP file for your new campaign element; otherwise, you can use the existing generic serialization JSP file, SerializeActivitygenericElement.jsp, as is. In both cases, you must register the serialization JSP file in the Struts configuration file for customization, struts-extension.xml. This file is initially empty and takes precedence over all Struts configuration files.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. If you need a new serialization JSP file, complete the following steps; otherwise, skip to step 3:
    1. 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

    2. Create a JSP file with this syntax: SerializeActivitycampaign_element_name.jsp, for example, SerializeActivityCustomLevelOfSupport.jsp.
    3. Define the new serialization JSP file.
      The following is a sample serialization JSP file for a custom target:
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <object objectType="customLevelOfSupport"> 1
          <parent><object objectId="${element.parentElementIdentifier.name}"/></parent> 2a
          <elemTemplateName><![CDATA[${element.campaignElementTemplateIdentifier.externalIdentifier.name}]]&gt;</elemTemplateName> 2b
          <elementName>${element.campaignElementIdentifier.name}</elementName> 2c
          <sequence>${element.elementSequence}</sequence> 2d
          <customerCount readonly="true">${element.count}</customerCount> 2e
          <c:forEach var="elementVariable" items="${element.campaignElementVariable}"> 3
              <${elementVariable.name}> 
                  <![CDATA[${elementVariable.value}]]&gt;
              </${elementVariable.name}>
          </c:forEach>
      </object>

      The following describes the lines with black numbered callouts:

      • 1 The objectType value must match the objectType defined in the object definition for this campaign element.
      • 2a-e These five elements are mandatory; include the lines of code exactly as shown in the previous example with no changes.
      • 3 The <c:forEach> element loops through all of the values stored for the campaign element in the DMELEMENTNVP table and returns all of the names (in elementVariable.name) and values (in elementVariable.value).

      This JSP must also return any wcfChildObjectDefinitions and wcfReferenceObjectDefinitions. To see examples of serialization JSP files that do so, review a default serialization JSP file for a similar campaign element. The default files are named SerializeActivitycampaign_element_name.jsp, for example, SerializeActivityonlineBehavior.jsp. The default files are stored at this path:

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

    4. Save and close the new serialization JSP file.
  3. Open the Spring configuration file, spring-extension.xml.
    The file is stored at this path:

    LOBTools/WebContent/WEB-INF

  4. Add a new action mapping to register the serialization JSP file:
    • If you created your own serialization JSP file, your action mapping should use the following syntax:
      <action path="/SerializeActivityElement-objectType_value" include="/jsp/your_company_name/marketing/name_of_serialization_jsp_file.jsp" />

      where

      • objectType_value is the value of the objectType attribute defined in the object definition for this campaign element
      • name_of_serialization_jsp_file is the name you gave to the custom serialization JSP file for your new campaign element in an earlier step of this procedure.
    • If you are using the generic serialization JSP file, your action mapping should use the following syntax:
      <action path="/SerializeActivityElement-objectType_value" include="/jsp/commerce/marketing/restricted/SerializeActivitygenericElement.jsp" />

      where objectType_value is the value of the objectType attribute defined in the object definition for this campaign element.

    Here are a couple of tips:
    • If you copied code from an existing serialization JSP file, you must update the paths as appropriate for any included JSP files.
    • If you change your serialization JSP file, make sure to edit the GetActivityChildren.jsp file. You do not need to make any changes to the GetActivityChildren.jsp file; just save it to change the file modification timestamp. The GetActivityChildren.jsp file includes the serialization JSP files, so this will ensure that your serialization JSP file changes are picked up.
  5. Restart the HCL Commerce test server to make the new configuration available.