Overriding a retrieve service for a Management Center object

To override an existing retrieve service, create a new controller JSP page and a new Struts action forward.

About this task

The new controller JSP page retrieves and mediates the Management Center object. The new Struts action forward points to the new controller JSP page. To create the new controller JSP page and Struts action forward:


  1. Identify the Management Center object read operation to override by identifying the Management Center service operation to override. Use the naming convention to identify the Struts action forward and the controller JSP file.
    For example, to identify which controller JSP file is used by the Catalog Entry Advanced Search:
    1. Complete one of the following steps:
    2. Complete one of the following steps:
      • WebSphere Commerce Version Pack 1 In the wcfSearchService section, specify the value of the URL property: url="/cmc/FindCatalogEntries-All". The URL property means that the Struts action is invoked by the search service.
      • Introduced in Feature Pack 2 In the SearchService section, note the value of the URL attribute: url="/cmc/FindCatalogEntries-All". This is the Struts action that is invoked by the search service.
    3. Navigate to LOBTools > WebContent > WEB-INF and double-click one of the following files to open it in the default editor:
      • WebSphere Commerce Version Pack 1 struts-ibm-tools.xml
      • Introduced in Feature Pack 2 struts-ibm-catalog.xml
      Note: Do not change this XML file since it might be replaced in a fix pack.
    4. Locate the action definition in the action-mappings section by searching for FindCatalogEntries-All. The search result is:
      <!-- Catalog Tool Search Definitions -->
      <!-- ========= -->
      <action path="/FindSKUs" forward="/jsp/commerce/catalog/restricted/FindSKUs.jsp" />
      <action path="/FindKits" forward="/jsp/commerce/catalog/restricted/FindKits.jsp" />
      <action path="/FindDynamicKits" forward="/jsp/commerce/catalog/restricted/FindDynamicKits.jsp" />
      <action path="/FindBundles" forward="/jsp/commerce/catalog/restricted/FindBundles.jsp" />
      <action path="/FindProducts" forward="/jsp/commerce/catalog/restricted/FindProducts.jsp" />
      <action path="/FindSalesCategories" forward="/jsp/commerce/catalog/restricted/FindSalesCategories.jsp" />
      <action path="/FindCatalogEntries-ExceptSKUs" forward="/jsp/commerce/catalog/restricted/FindAllCatalogEntriesExceptSKUs.jsp" />
      <action path="/FindCategories-All" forward="/jsp/commerce/catalog/restricted/FindAllCategories.jsp" />
      <action path="/FindCatalogEntries-All" forward="/jsp/commerce/catalog/restricted/FindAllCatalogEntries.jsp" />
      <action path="/FindCatalogs" forward="/jsp/commerce/catalog/restricted/FindCatalogs.jsp" />
    5. The search result for FindCatalogEntries-All indicates that the controller JSP file to be extended is /jsp/commerce/catalog/restricted/FindAllCatalogEntries.jsp.
  2. Open WebSphere Commerce Developer.
  3. Navigate to the LOBTools project.
  4. Create a new directory under the WebContent/jsp directory to contain the customized JSP files. For example, WebContent/jsp/myComponent.
  5. Create a JSP file that determines whether to handle the request or to forward it to the IBM-supplied JSP file. If the JSP file determines that the request should be handled, it must also specify how to handle the request.
    For example:
    1. Navigate to LOBTools > WebContent > jsp.
    2. To create the JSP extension folder, right-click jsp and select New > Folder.
    3. In the Folder name field, type mycompany, click Next, and then click Finish.
    4. In the mycompany directory, create a folder that is called catalog.
    5. To create the extension controller JSP file, right-click the catalog folder and select New > File.
    6. In the File name field, type FindAllCatalogEntries-WithWarrentyCriteria.jsp, and then click Finish.
    7. Copy the following code into the FindAllCatalogEntries-WithWarrentyCriteria.jsp file:
      <?xml version="1.0" encoding="UTF-8"?>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <%@ taglib uri="http://commerce.ibm.com/foundation" prefix="wcf"%>
      <%-- Decide which expression builder to call based on the input --%>
        var="catentries" expressionBuilder="findMyCompanyAdvancedSearch"
        <wcf:contextData name="storeId" data="${param.storeId}" />
        <wcf:contextData name="catalogId" data="${catalog}" />
        <wcf:param name="shortDescription" value="" />
        <wcf:param name="mfPartNumber" value="${param.mfPartNumber}" />
        <wcf:param name="mfName" value="${param.manufacturer}" />
        <wcf:param name="groupIdentifier" value="${param.parentCategory}" />
        <c:if test="${param.wartermSelection != 'null'}">
          <c:set var="warterm" value="${param.wartermSelection}" />
        <wcf:param name="wartermSelection" value="${warterm}" />
        <c:if test="${param.wartypeSelection != 'null'}">
          <c:set var="wartype" value="${param.wartypeSelection}" />
        <wcf:param name="wartypeSelection" value="${wartype}" />>
        <wcf:param name="partNumber" value="${catentryCode}" />
        <wcf:param name="name" value="${catentryName}" />
        <c:set var="productExp" value="ProductBean" />
        <c:set var="bundleExp" value="BundleBean" />
        <c:set var="kitExp" value="PackageBean" />
        <c:set var="dynamicKitExp" value="DynamicKitBean" />
        <c:set var="SKUExp" value="ItemBean" />
        <c:if test="${(empty param.published)}">
          <wcf:param name="published" value="" />
        <c:if test="${param.published == '1'}">
          <wcf:param name="published" value="1" />
        <c:if test="${param.published == '2'}">
          <wcf:param name="published" value="0" />
        <c:if test="${param.published == '3'}">
          <wcf:param name="published" value="" />
        <c:if test="${(empty param.catentryTypes)}">
          <wcf:param name="catEntryTypes"
            value="${productExp},${bundleExp},${kitExp},${dynamicKitExp},${SKUExp}" />
        <c:if test="${param.catentryTypes == '1'}">
          <wcf:param name="catEntryTypes"
            value="${productExp},${bundleExp},${kitExp},${dynamicKitExp}" />
        <c:if test="${param.catentryTypes == '2'}">
          <c:set var="typeParam" value="" />
          <c:if test="${param.typeProducts == 'true'}">
            <c:if test="${typeParam != ''}">
              <c:set var="typeParam" value="${typeParam}," />
            <c:set var="typeParam" value="${typeParam}${productExp}" />
          <c:if test="${param.typeBundles == 'true'}">
            <c:if test="${typeParam != ''}">
              <c:set var="typeParam" value="${typeParam}," />
            <c:set var="typeParam" value="${typeParam}${bundleExp}" />
          <c:if test="${param.typeKits == 'true'}">
            <c:if test="${typeParam != ''}">
              <c:set var="typeParam" value="${typeParam}," />
            <c:set var="typeParam" value="${typeParam}${kitExp},${dynamicKitExp}" />
          <c:if test="${param.typeSKUs == 'true'}">
            <c:if test="${typeParam != ''}">
              <c:set var="typeParam" value="${typeParam}," />
            <c:set var="typeParam" value="${typeParam}${SKUExp}" />
          <wcf:param name="catEntryTypes" value="${typeParam}" />
        file="../../commerce/catalog/restricted/serialize/SerializeCatalogEntries.jspf" />
      Note: The JSP file uses the new expression Builder, findMyCompanyAdvancedSearch, to get data that is defined later in the Creating a new expression builder to override a default expression builder step.
  6. Implement the new get-data expression and forward to the existing serialization JSP file.
  7. Navigate to the WebContent/WEB-INF directory and open one of the following files:
    • WebSphere Commerce Version Pack 1struts-ibm-tools.xml
    • Introduced in Feature Pack 2struts-ibm-catalog.xml
    In the file, locate the Struts action forward that you want to customize.
  8. Copy the Struts action forward configuration to the struts-extension.xml file and update the Struts action forward path attribute to point to the new controller JSP page.
  9. Deploy your changes to your production environment.