<es:forEachInArray> Tag

The <es:forEachInArray> tag is used to iterate over an array. It is often used with other WebLogic Portal JSP tags to iterate over arrays of returned objects.

Syntax

<tagName attribute="value" />

Attributes

id

Required (String) - The variable for each value in the array as an object of type Type.

type

Required (String) - The type of each value in the array, which must match the elements of the array.

array

Required (Object array) - The array to iterate over.

counterId

Optional (String) - The position in the array as an Integer.

Example 1

This example iterates over an array and prints the results.

<es:forEachInArray id="item" array="<%=items%>" type="String" counterId="i">
<% System.out.println("items[" + i + "]: " + item);%>
</es:forEachInArray>

Example 2

This example, used in conjunction with the <pz:contentSelector> tag to retrieve personalized Web content for a user, iterates over an array of content objects retrieved from a content management system for display to the user.

<profile:getProfile profileKey="bob" profileId="myProfile" scope="session"/>
<pz:contentSelector rule="PremierCustomerSpotlight" id="docs" />
<ul>
<es:forEachInArray array="<%=docs%>" id="aDoc" type="com.bea.p13n.content.Node">
<li>The document title is: <cm:printproperty id="aDoc" name="Title" encode="html" />
</es:forEachInArray>
</ul>

Related Topics

<profile:getProfile> Tag

<pz:contentSelector> Tag