Class Name

atg.commerce.catalog.custom.ForEachItemInCatalog

Component(s)

/atg/commerce/catalog/ForEachItemInCatalog

The ForEachItemInCatalog servlet bean renders its output open parameter once for each element in the array input parameter that exists in the user’s the current catalog.

The servlet bean is an instance of atg.commerce.catalog.custom.ForEachItemInCatalog, which extends atg.droplet.ForEach. ForEachItemInCatalog has one additional parameter, profile, which is used to get the current catalog for the user (from the Profile.catalog property).

Input Parameters

array (Required)
The parameter that defines the list of items to output. This parameter can be Collection (Vector, List, or Set), Enumeration, Iterator, Map, Dictionary, or array.

profile
The current user’s profile.

sortProperties
A string that specifies how to sort the list of items in the output array. Sorting can be performed on properties of JavaBeans, Dynamic Beans, or on Dates, Numbers, or Strings.

To sort JavaBeans, specify the value of sortProperties as a comma-separated list of property names. The first name specifies the primary sort, the second specifies the secondary sort, and so on. If the first character of each keyword is a +, this sort is performed in ascending order. If it has a -, it is a descending order.

Example: To sort an output array of JavaBeans first alphabetically by title property and second in descending order of the size property:

<param name="sortProperties" value="+title,-size">

To sort Dates, Numbers, or Strings, specify the value of sortProperties with either a single “+” or a single “-” to indicate ascending or descending order respectively.

Example: To sort an output array of Strings in alphabetical order:

<param name="sortProperties" value="+">

reverseOrder
A boolean value that specifies whether the traversal order in the array should be back to front or front to back. To sort from back to front, set this parameter to true. To sort from front to back, set this parameter to false. Note that this parameter only takes effect if the sortProperties input parameter is not set.

Output Parameters

index
This parameter is set to the zero-based index of the current element of the array each time that the output parameter is rendered. The value of index for the first iteration is 0.

count
This parameter is set to the one-based index of the current element of the array each time that the output parameter is rendered. The value of count for the first iteration is 1.

key
If the array parameter is a Map or Dictionary, this parameter is set to the value of the key in the Map or Dictionary.

element
This parameter is set to the current element of the array each time that the index increments and the output parameter is rendered.

size
This parameter is set to the size of the array, if applicable. If the array is an Enumeration or Iterator, size is set to -1.

Open Parameters

output
This parameter is rendered once for each element in the array.

outputStart
If the array is not empty, this parameter is rendered before any output elements. It can be used to render the heading of a table, for instance.

outputEnd
If the array is not empty, this parameter is rendered after all output elements. It can be used to render text following a table, for instance.

empty
This optional parameter is rendered if the array contains no elements.

Example

The following JSP example uses ForEachItemInCatalog to display a list of related products for a given product on a product display page. Each related product is a link that redisplays the product display page with the selected related product.

<dsp:droplet name="/atg/commerce/catalog/ForEachItemInCatalog">
 <dsp:param param="element.relatedProducts" name="array"/>

  <dsp:oparam name="outputStart">
   <table border=0 cellpadding=1 width=100%>
   <tr><td><span class=smallbw>&nbsp;Related Items</span></td></tr>
   <tr><td></td></tr>
  </dsp:oparam>

   <dsp:oparam name="output">
    <tr><td>
    <dsp:getvalueof id="a28" param="element.template.url"
                idtype="java.lang.String">
<dsp:a href="<%=a28%>">
    <dsp:param param="element.repositoryId" name="id"/>
    <dsp:param value="jump" name="navAction"/>
    <dsp:param param="element" name="Item"/>
    <dsp:valueof param="element.displayName">
         No name</dsp:valueof></dsp:a></dsp:getvalueof><br>
    </td></tr>
   </dsp:oparam>

  <dsp:oparam name="outputEnd">
   </table>
  </dsp:oparam>
</dsp:droplet>

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