Tutorials > Customize the Consumer Direct sample store > Customizing the consumer direct sample store using snippets
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
- 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.
- In Rational Application Developer, in the Enterprise Explorer view, navigate to Stores > Java Resources > src > MyApparelStore .
- Right-click the MyApparelStore folder and select Import.
- Select File System and click Next.
- In the From directory field, enter or browse to WCDE_INSTALL/\samples\Snippets\properties\Catalog.
- Click Select All and click Finish.
- Import the JSP code snippet into Rational Application Developer:
- In the Enterprise Explorer view, navigate to Stores > WebContent > MyApparelStore.
- Right-click the include directory and select Import.
- Select File System and click Next.
- In the From directory field, enter or browse to WCDE_INSTALL/\samples\Snippets\web\Catalog\SalesCatalog.
- Select StoreCatalogDisplay.jsp and click Finish.
- Modify the StoreCatalogDisplay.jsp file:
- Right-click the StoreCatalogDisplay.jsp file and select Open With > Source Editor.
- Locate the following code:
<%-- [Data Bean Activation] <wcbase:useBean classname="com.ibm.commerce.common.beans.StoreDataBean" /> [Data Bean Activation] --%>
- Delete the lines <%-- [Data Bean Activation] and [Data Bean Activation] --%> to uncomment the line <wcbase:useBean classname="com.ibm.commerce.common.beans.StoreDataBean" />
- Save the changes.
- Modify the CachedHeaderDisplay.jsp file to include the StoreCatalogDisplay.jsp code snippet:
- In the Enterprise Explorer view, navigate to the Stores > Web Content > MyApparelStore > include > styles > style1 directory.
- Right-click the CachedHeaderDisplay.jsp file and select Open With > Source Editor.
- Locate the following code:
</tbody> </table> <!--END HEADER--> <!-- End - JSP File name: style1/CachedHeaderDisplay.jsp -->
- 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 -->
- Save the changes