Performs a targeting operation and passes the results to another servlet bean for display.

Class Name

atg.targeting.TargetingArray

Component

/atg/targeting/TargetingArray

Required Input Parameters

targeter

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

Optional Input Parameters

filter

A 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.

sourceMap

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. The default value is /atg/targeting/TargetingSourceMap.

sortProperties

The display order of result set elements. See Sorting Results in the Serving Targeted Content with ATG Servlet Beans chapter on information about specifying this parameter, and the relationship between targeter sorting and servlet bean sorting.

Output Parameters

elements

Set to the results of the targeting operation, an array of repository items.

Open Parameters

output

The parameter to render. Nest a formatting servlet bean such as the ForEach servlet bean in this parameter in order to display the output of the targeting operation.

empty

Rendered if the targeting operation returns no matching items.

Usage Notes

TargetingArray 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. TargetingArray is the most general form of targeting servlet bean. It returns all content items that satisfy the targeter’s rules, but does not format the output. Use this servlet bean with another servlet bean such as ForEach to specify formatting for each of the content items returned by the targeting operation. TargetingArray’s output parameter contains the inner formatting servlet bean.

Example

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

<%-- outer ATG Servlet Bean obtains the targeted content --%>
<dsp:droplet name="/atg/targeting/TargetingArray">
  <dsp:param name="targeter"
  bean="/atg/registry/RepositoryTargeters/TargetedContent/SkiResortTargeter"/>
  <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"
        idtype="java.lang.String"/>
          <dsp:a href="${URL}">
            <dsp:valueof param="element.displayName"/>
          </dsp:a>
        <dsp:getvalueof var="image" param="element.image"
        idtype="java.lang.String"/>
          <img src="${image}"/>
        <p>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:oparam>
</dsp:droplet>
 
loading table of contents...