Constructs an RQL query and renders its output parameter once for each element returned by the query.

Class Name




Required Input Parameters


The repository to query.


The name of the item type to query.


The RQL query to execute.

Optional Input Parameters


The Transaction Manager to use. For example:

<dsp:param name="transactionManager"


Holds a string that specifies the order to render array items. The syntax of this parameter depends on the array item type: JavaBean, Dynamic Bean, Date, Number, or String.

To sort on the properties of a JavaBean, specify the value of sortProperties as a comma-separated list of property names. You can sort on an unlimited number of properties, where the first property name specifies the primary sort, the second property name specifies the secondary sort, and so on. To specify ascending sort order, prepend the property name with a plus + sign; to specify descending order, prepend with a minus - sign.

The following input parameter sorts a JavaBean array alphabetically by title, then in descending order of size:

<dsp:param name="sortProperties" value="+title,size"/>

If the array contains Dates, Numbers, or Strings, prepend the sortProperties value with a plus + or minus sign to specify ascending or descending sort order..

The following example sorts an output array of Strings in alphabetical order:

<dsp:param name="sortProperties" value="+"/>

In order to sort Map elements by key, set the value as follows:


For example:

<dsp:param name="sortProperties" value="_key"/>

A nested servlet bean inherits the parent servlet bean’s sortProperties setting, unless the nested servlet bean has its own sortProperties setting. For example, the following setting negates any parent sortProperties setting:

<dsp:param name="sortProperties" value=""/>

Output Parameters


The zero-based index of the returned row.


The one-based number of the returned row.


A dynamic bean that has properties for accessing the values returned in the result set. To return a particular property value for each item in the result set, use the convention, where name is any property name supported by the item descriptor.


If a RepositoryException is thrown, set to the exception.

Open Parameters

The following open parameters control the formatting for the returned results:


Rendered once for each array element.


Rendered before any output tags if the array is not empty.


Rendered after all output tags if the array is not empty.


Rendered if the array contains no elements.


Rendered if there is an error when the query executes.

Usage Notes

RQLQueryForEach executes a RQL query and renders its output open parameter once for each element returned by the query. The query can be a simple query or can include parameters. The syntax for specifying a parameter is different from the syntax normally used in RQL. For example, you might want to issue this RQL query:

age > ?0

RQLQueryForEach can specify the query as follows:

<dsp:param name="queryRQL" value="age > :whatAge"/>

The value for the whatAge argument is supplied through a parameter. For example, the link to the page containing the servlet bean might be:

<dsp:a href="">Click here if you are
over 35<dsp:param name="whatAge" value="35"/>

For more information about RQL, see the Repository Queries chapter of the Repository Guide.


The following example uses RQLQueryForEach to display a list of all users in the Personalization profile repository whose profiles indicate they are eligible to receive email.

<p>The following customers are eligible to receive email:

<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
  <dsp:param name="queryRQL" value="receiveEmail=true"/>
  <dsp:param name="repository"
  <dsp:param name="itemDescriptor" value="user"/>
  <dsp:oparam name="output">
    <p><dsp:valueof param="element.lastName"/>

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