<cat:iterateViewIterator> Tag

Use the <cat:iterateViewIterator> tag to iterate through a ViewIterator. A ViewIterator is an iterator over a potentially large collection of remote data that is broken up into a series of fixed sized Views. ViewIterators are returned from all Catalog service API methods that may potentially return a large set of ProductItems or Categories. This tag allows you to iterate the ViewIterator one item (ProductItem or Category) at a time (the default behavior) or by an entire View (fixed size set of ProductItems or Categories) at a time. This tag does not reset the state of the ViewIterator upon completion.

Syntax

<tagName attribute="value">
</tagName>

id

Required (String) - id="newInstance". The value of the current iterated object will be available in the variable name to which the id is assigned.

iterator

Required (ViewIterator) - Denotes a reference to a ViewIterator object. Must be presented in the form <%= iteratorReference %>.

iterateByView

Optional (String) - iterateByView="{true|false}". Specifies whether to iterate the ViewIterator by View or by Catalog item. If not specified, the ViewIterator will be iterated by Catalog item.

returnType

Optional (String) - returnType="returnType". Declares the type of the variable specified by the id attribute. Defaults to java.lang.Object. If iterateByView is true, the type is assumed to be com.beasys.commerce.ebusiness.catalog.View.

Example 1

This example displays the keys of all Categories in a ViewIterator:

<cat:iterateViewIterator iterator="<%= myIterator %>"
id="category" 
returnType="com.beasys.commerce.ebusiness.catalog.Category">
<%= category.getKey().toString() %>
</cat:iterateViewIterator>

Example 2

This example displays all the Views contained within a ViewIterator:

<cat:iterateViewIterator iterator="<%= myIterator %>"        
id="view" 
returnType="com.beasys.commerce.ebusiness.catalog.ViewIterator"iterateByView="true"> 
<%= view.toString() %>
</cat:iterateViewIterator>

Related Topics

<cat:iterateThroughView> Tag