In this lesson, you are
customizing your Management Center user interface to call the service
for returning folder information from the WebSphere Commerce web services.
You are also registering your new JSP files into the Struts configuration.
Attention: This tutorial is based on
the folder support that is included in Feature Pack 5 and is not recommended
if you are on a newer feature pack level. Beginning with Feature Pack
6, support is provided by default for grouping e-Marketing Spots,
activities, customer segments, marketing content, promotions, and
attribute dictionary attributes. This support includes the capability
of creating, changing, and deleting folders within the Management
Center Catalogs, Marketing, and Promotions tools. You are not able
to group folders created by following this tutorial with folders that
are created by using Management Center. If you create Management Center
folders by following the steps included in this tutorial, delete those
folders before you create folders by using Management Center. For
more information about folders, see
Folders.
Support is provided by
default for grouping content pages and layouts in the Commerce Composer tool.
This support includes creating, changing, and deleting folders with
the Commerce Composer tool.
About this task
To customize your Management Center user interface to
receive and display folder information, you must create JSP files
for your folder information. You must register these folder JSP files
into the Struts configuration before Management Center can retrieve
and display folder information. By creating your folder JSP files
and registering these files into the Struts configuration you are
customizing your Management Center web application.
The JSP files
that you are creating in this lesson are added into the WebSphere
Commerce web Application. These JSP files connect the WebSphere Commerce web
services to your Management Center user interface. For more information
about how Management Center is constructed, see Management Center framework.
The
Management Center web application acts as a mediator between the Management
Center and WebSphere Commerce services. The Management Center web
application converts requests and responses into the appropriate data
type. When data is sent from the WebSphere Commerce Server to Management
Center, the Management Center web application transforms nouns into
the XML representation that is expected by Management Center. The
JavaServer Pages (JSP) file that represents the Struts action forward
is used to transform nouns into XML format.
For more information
about how Management Center sends and receives data, see Management Center web application. For
more information about creating JSP files, see working
with JSP pages.
Procedure
- Create the GetEMarketingSpotFolderItems.jsp JSP
file:
- In the Enterprise Explorer view, navigate to .
- Right-click marketing; click .
- For the File name, enter GetEMarketingSpotFolderItems.jsp.
- Click Finish. The GetEMarketingSpotFolderItems.jsp file
opens.
- Click the Source tab.
- Add the following code into the new JSP file:
<?xml version="1.0" encoding="UTF-8"?>
<%@page contentType="text/xml;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://commerce.ibm.com/foundation" prefix="wcf"%>
<wcf:getData
type="com.ibm.commerce.infrastructure.facade.datatypes.FolderType"
var="folder"
expressionBuilder="getFolderItemsByFolderId"
varShowVerb="showVerb"
recordSetStartNumber="${param.recordSetStartNumber}"
recordSetReferenceId="${param.recordSetReferenceId}"
maxItems="${param.maxItems}">
<wcf:contextData name="storeId" data="${param.storeId}"/>
<wcf:param name="uniqueID" value="${param.folderId}"/>
</wcf:getData>
<objects
recordSetCompleteIndicator="${showVerb.recordSetCompleteIndicator}"
recordSetReferenceId="${showVerb.recordSetReferenceId}"
recordSetStartNumber="${showVerb.recordSetStartNumber}"
recordSetCount="${showVerb.recordSetCount}"
recordSetTotal="${showVerb.recordSetTotal}">
<c:set var="idList" value=""/>
<c:set var="objectClass" value=""/>
<c:forEach items="${folder.folderItem}" var="folderItem" varStatus="counter">
<c:choose>
<c:when test="${counter.index == 0}">
<c:set var="objectClass" value="${folderItem.folderItemType}"/>
<c:set var="idList" value="${folderItem.referenceID}"/>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${folderItem.folderItemType == objectClass}">
<c:set var="idList" value="${idList}${','}${folderItem.referenceID}"/>
</c:when>
<c:otherwise>
<jsp:directive.include file="SerializeEMarketingSpotFolderItemReferences.jspf" />
<c:set var="objectClass" value="${folderItem.folderItemType}"/>
<c:set var="idList" value="${folderItem.referenceID}"/>
</c:otherwise>
</c:choose>
</c:otherwise>
</c:choose>
<c:if test="${counter.last}">
<jsp:directive.include file="SerializeEMarketingSpotFolderItemReferences.jspf" />
</c:if>
</c:forEach>
</objects>
- Save your changes.
- Create the SerializeEMarketingSpotFolderItemReferences.jspf file:
- In the Enterprise Explorer view, navigate to .
- Right-click marketing; click .
- For the File name, enter SerializeEMarketingSpotFolderItemReferences.jspf.
- Click Finish. The SerializeEMarketingSpotFolderItemReferences.jspf file
opens.
- Click the Source tab.
- Add the following code into the new file:
<c:if test="${objectClass == 'MarketingSpotType'}">
<wcf:getData
type="com.ibm.commerce.marketing.facade.datatypes.MarketingSpotType[]"
var="espots" expressionBuilder="findByUniqueIDs" varShowVerb="showVerb">
<c:forTokens var="value" items="${idList}" delims=",">
<wcf:param name="UniqueID" value="${value}" />
</c:forTokens>
<wcf:param name="dataLanguageIds" value="${param.defaultLanguageId}"/>
<wcf:contextData name="storeId" data="${param.storeId}"/>
</wcf:getData>
<c:forEach var="spot" items="${espots}">
<c:set var="showVerb" value="${showVerb}" scope="request"/>
<c:set var="businessObject" value="${spot}" scope="request"/>
<c:set var="referenceObjectType" value="EMarketingSpotFolderItemReference"/>
<c:set var="owningStoreId" value="${param.storeId}"/>
<c:if test="${param.storeId != spot.marketingSpotIdentifier.externalIdentifier.storeIdentifier.uniqueID}">
<c:set var="referenceObjectType" value="EMarketingSpotFolderInheritedItemReference"/>
<c:if test="${param.storeId != folder.folderIdentifier.storeIdentifier.uniqueID}">
<c:set var="referenceObjectType" value="InheritedEMarketingSpotFolderInheritedItemReference"/>
<c:set var="owningStoreId" value="${folder.folderIdentifier.storeIdentifier.uniqueID}"/>
</c:if>
</c:if>
<object objectType="${referenceObjectType}" readonly="false">
<changeControlModifiable>true</changeControlModifiable>
<folderItemID>${folder.folderIdentifier.uniqueID}_${spot.marketingSpotIdentifier.uniqueID}</folderItemID>
<folderItemReferenceId>${spot.marketingSpotIdentifier.uniqueID}</folderItemReferenceId>
<objectStoreId>${owningStoreId}</objectStoreId>
<jsp:directive.include file="restricted/SerializeEMarketingSpot.jspf"/>
</object>
</c:forEach>
</c:if>
This code calls the expression builder getFolderItemsByFolderId,
which returns all the folder items in a folder. That service request
returns a Folder noun with one FolderItem noun part for each e-Marketing
Spot in the folder. The JSP then creates a list of all the unique
IDs of the e-Marketing Spots in the folder. SerializeFolderItemReferences.jspf is
called and in turn calls the findByUniqueIDs expression
builder to return a list of e-Marketing Spots. These e-Marketing Spots
have the unique IDs found in the list that returns from the folder
service.
Note: You can find the expression builder
information in the file get-data-config.xml. Navigate
to the LOBTools\WebContent\WEB-INF\config\com.ibm.commerce.marketing directory
to locate the file.
- Save your changes.
- Register the actions in the struts action configuration:
- In the Enterprise Explorer view, expand
- Open the struts-extension.xml file.
- Click the Source tab.
- Add the following code to the XML file.
<action path="/GetEMarketingSpotFolderItems" forward="/jsp/commerce/marketing/GetEMarketingSpotFolderItems.jsp"/>
- Save your changes.