Tutorials > Customize the Consumer Direct sample store > Customizing the consumer direct sample store using snippets

< Previous | Next >


Display MyApparelSalesCatalog using a JSP code snippet

In this step, we will use the SalesCatalog JSP code snippet to display MyApparelSalesCatalog in the sidebar of MyApparelStore.

To use the SalesCatalog JSP code snippet:


Procedure

  1. Import the properties file into Rational Application Developer. The properties file contains the text that displays in the Web browser, and a copy with translated text should exist for each locale supported by the store.

    1. In Rational Application Developer, in the Enterprise Explorer view, navigate to Stores > Java Resources > src > MyApparelStore .

    2. Right-click the MyApparelStore folder and select Import.

    3. Select File System and click Next.

    4. In the From directory field, enter or browse to WCDE_INSTALL/\samples\Snippets\properties\Catalog.

    5. Click Select All and click Finish.

  2. Import the JSP code snippet into Rational Application Developer:

    1. In the Enterprise Explorer view, navigate to Stores > WebContent > MyApparelStore.

    2. Right-click the include directory and select Import.

    3. Select File System and click Next.

    4. In the From directory field, enter or browse to WCDE_INSTALL/\samples\Snippets\web\Catalog\SalesCatalog.

    5. Select StoreCatalogDisplay.jsp and click Finish.

  3. Modify the StoreCatalogDisplay.jsp file:

    1. Right-click the StoreCatalogDisplay.jsp file and select Open With > Source Editor.

    2. Locate the following code:

      <%-- [Data Bean Activation]
      <wcbase:useBean  classname="com.ibm.commerce.common.beans.StoreDataBean" />
      [Data Bean Activation] --%>
      

    3. Delete the lines <%-- [Data Bean Activation] and [Data Bean Activation] --%> to uncomment the line <wcbase:useBean classname="com.ibm.commerce.common.beans.StoreDataBean" />

    4. Save the changes.

  4. Modify the CachedHeaderDisplay.jsp file to include the StoreCatalogDisplay.jsp code snippet:

    1. In the Enterprise Explorer view, navigate to the Stores > Web Content > MyApparelStore > include > styles > style1 directory.

    2. Right-click the CachedHeaderDisplay.jsp file and select Open With > Source Editor.

    3. Locate the following code:

      </tbody>
      </table>
      
      <!--END HEADER-->
      <!-- End - JSP File name: style1/CachedHeaderDisplay.jsp -->
      

    4. Before the </tbody> tag, insert the following code:

      <tr>
         
      <td>
             
      <table>
                     
      <!--Start Sales Catalog JSP code snippet -->
                     
      <tr><td>
                  
      <c:import url="${jspStoreDir}include/StoreCatalogDisplay.jsp" />
                      
      </td></tr>
                     
      <!--End Sales Catalog JSP code snippet -->
             
      </table>
             
      </td>
      </tr>
       
      

      The resulting code should look like the following:

      <!--Start Sales Catalog JSP code snippet -->
      <tr>
         
      <td>
             
      <table>
             
      <tr><td>
             
      <c:import url="${jspStoreDir}include/StoreCatalogDisplay.jsp" />
              
      </td></tr>
             
      </table>
         
      </td>
      </tr>
      <!--End Sales Catalog JSP code snippet -->
      

      </tbody>
      </table>
      
      <!--END HEADER-->
      <!-- End - JSP File name: style1/CachedHeaderDisplay.jsp -->
      

    5. Save the changes

< Previous | Next >


+

Search Tips   |   Advanced Search