The TargetingArray servlet bean performs a targeting operation with the help of its targeter and sourceMap parameters, and sets the output elements parameter to the resulting array of target objects. The TargetingArray servlet bean is the most general form of targeting servlet bean. It returns all of the content items that satisfy the targeter’s rules, but does not format the output. You should use the TargetingArray servlet bean with another ATG Servlet Bean, such as the ForEach servlet bean, to specify formatting for each of the content items returned by the targeting operation. The TargetingArray servlet bean’s output parameter contains the inner formatting servlet bean.

Input Parameters

The targeter service that performs the targeting operation. Must be an instance of a class that implements the Targeter interface, such as atg.targeting.DynamicContentTargeter.

Specifies an optional filter service that filters the items returned by the targeter before they are output. Must be an instance of a class that implements the ItemFilter interface, such as atg.targeting.conflict.TopicHistoryConflictFilter.

Represents a mapping between names of source objects associated with a targeting operation and their values. Must be an instance of atg.targeting.TargetingSourceMap. If this parameter is omitted, the source Map specified by the servlet bean’s defaultSourceMap property is used. (By default, the value of this property is /atg/targeting/TargetingSourceMap.)

Specifies the display order of result set elements. See
Sorting Results in the Serving Targeted Content with ATG Servlet Beans chapter for information about how to specify this parameter, and for information about the relationship between sorting performed by the targeter and sorting performed by the servlet bean.

Output Parameter

This output parameter is set to the results of the targeting operation, an array of items from the Repository.

Open Parameters

The parameter to render. You should nest a formatting ATG Servlet Bean, such as the ForEach servlet bean, in the output parameter to display the output of the targeting operation.

This optional parameter is rendered if the targeting operation returns no matching items.


This example displays all of the ski resorts returned from the targeting result set. It uses the ForEach servlet bean to display the output. For each resort, the JSP containing this servlet bean displays the name (in a hypertext link) and an image. Note that this example is identical in output to the TargetingForEach Example; you are more likely to use the TargetingArray servlet bean with your own customized ATG Servlet Bean instead of a basic servlet bean like ForEach.

<%-- outer ATG Servlet Bean obtains the targeted content --%>
<dsp:droplet name="/atg/targeting/TargetingArray">
  <dsp:param name="targeter"
  <dsp:oparam name="output">
    <%-- inner ATG Servlet Bean displays the results --%>
    <dsp:droplet name="/atg/dynamo/droplet/ForEach">
      <dsp:param name="array" param="elements"/>
      <dsp:param name="sortProperties" value="+displayName"/>
      <dsp:oparam name="output">
        <dsp:getvalueof var="URL" param="element.URL"
          <dsp:a href="${URL}">
            <dsp:valueof param="element.displayName"/>
        <dsp:getvalueof var="image" param="element.image"
          <img src="${image}"/>
loading table of contents...