Develop > Presentation layer > Customize marketing > Marketing customization: Management Center > Customizing triggers, targets, and actions > Add a new trigger, target or action


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


Before you beginReview the following topic to understand the format of the XML response that the server returns:


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, create a new serialization JSP file for the new campaign element; otherwise, you can use the existing generic serialization JSP file, SerializeActivitygenericElement.jsp, as is. In both cases, 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 WebSphere 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 the 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 Struts configuration file, struts-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 the own serialization JSP file, the 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 the new campaign element in an earlier step of this procedure.

    • If you are using the generic serialization JSP file, the 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 the 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 the serialization JSP file changes are picked up.

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


What to do nextAfter you complete the customization:

  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the WCDE_INSTALL\workspace\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.


Previous topic: Add the campaign element to the element palette in the Activity Builder _vcc_freeselect_bottom_


+

Search Tips   |   Advanced Search