You can display categories and products on your commerce site using JSPs. Rather than requiring you to create a separate JSP for each page on your commerce site, you can to create template pages that fill in the product’s properties dynamically. You can then specify which template to use as a property of the category or product. This enables you to display any item without knowing in advance what template the item uses.

For example, the following portion of a JSP uses a CategoryLookup servlet bean to retrieve the current category, and a ForEach servlet bean to create links to all of the child products of the category. The URL for each link is found by looking at the template.url property of the product being linked to.

<dsp:droplet name="/atg/commerce/catalog/CategoryLookup">
<dsp:param param="itemId" name="id"/>

<dsp:oparam name="output">
 <dsp:droplet name="/atg/dynamo/droplet/ForEach">
   <dsp:param param="element.childProducts" name="array"/>
   <dsp:oparam name="outputStart">
   <p><b>Child Products:</b>
   <dsp:oparam name="output">
   <dsp:getvalueof var="templateURL" param="element.template.url"/>
<dsp:a href="${templateURL}">
   <dsp:valueof param="element.displayName"/>
   <dsp:param param="element.repositoryId" name="itemId"/>

For information about the CategoryLookup and ProductLookup servlet beans, see the Catalog Navigation and Searching chapter of the ATG Commerce Guide to Setting Up a Store.

Media Properties

Media elements such as images and JSPs can be associated with a category or product. Both item types have a template property, as well as three image properties: thumbnailImage, smallImage, and largeImage. In addition to the explicit properties that store media, a Map property called auxiliaryMedia allows you to store any number of other media elements. You can also extend the category or product item to include additional properties, as discussed in the Extending the Category and Product Item Types section.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices