ClassName

atg.targeting.TargetingRange

Component

/atg/targeting/TargetingRange

The TargetingRange servlet bean is a specialized version of the Range servlet bean. TargetingRange takes the results of the targeting operation and displays a selection of the items returned, beginning with the item whose count is the start parameter. The number of items displayed is set by the howMany parameter (the default is 1). The targeter component used for the targeting operation is set by the targeter and sourceMap input parameters. The TargetingRange servlet bean renders its output parameter for each element in the resulting collection of target objects, starting at the count (inclusive) specified by the start input parameter and ending when it has satisfied the howMany input parameter. For example, if start = 1 and howMany= 10, the first 10 elements of the result set are displayed; if start = 11, the next 10 elements are displayed

Input Parameters

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

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

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. (By default, the value of this property is /atg/targeting/TargetingSourceMap.)

start
Specifies which element of the array to start with. Setting start=1 renders the array beginning with its first element. If start is greater than the number of elements in the array and the empty output parameter is supplied in your implementation, the empty parameter is rendered.

howMany
Specifies the number of items in the array to display. If the combination of start and howMany points past the end of the array, Range stops rendering when the end of the array is reached.

sortProperties
Specifies the order to display 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.

fireViewItemEvent
Indicates whether to trigger a JMS view item event when a page is accessed. Default is true, so an event is fired if this parameter is omitted. To prevent the ATG platform from firing a view item event, set this parameter to false.

fireContentEvent
Indicates whether to trigger an even when a page is accessed. By setting this parameter to true or omitting it, you cause a JMS view event to fire, and when the accessed page is an item in a Content repository, a content viewed event also fires. To prevent the ATG platform from firing these two events, set this parameter to false. It is recommended that you use the fireViewItemEvent parameter instead of the fireContentEvent parameter.

fireContentTypeEvent
Indicates whether to trigger an even when a page is accessed. By setting this parameter to true or omitting it, you cause a JMS view event to fire, and when the accessed page is an item in a Content repository, a content type event also fires. To prevent the ATG platform from firing these two events, set this parameter to false. It is recommended that you use the fireViewItemEvent parameter instead of the fireContentTypeEvent parameter.

Output Parameters

index
This parameter is set to the zero-based index of the current element of the array each time the output parameter is rendered. For example, if start is set to 1, the value of index for the first iteration is 0.

count
This parameter is set to the one-based index of the current element of the array each time the output parameter is rendered. For example, if start is set to 1, the value of count for the first iteration is 1.

element
This parameter is set to the current element of the array each time the index increments and the output parameter is rendered.

hasPrev
This parameter is set to true before any of the output parameters are rendered. It indicates whether there are any array items before the current array set.

prevStart
This parameter is set before any of the output parameters are rendered, and only if hasPrev is true. It indicates the value of start that should be used to display the previous array set.

prevEnd
This parameter is set before any of the output parameters are rendered, and only if hasPrev is true. It indicates the (1-based) count of the last element in the previous array set.

prevHowMany
This parameter is set before any of the output parameters are rendered, and only if hasPrev is true. It indicates the number of elements in the previous array set.

hasNext
This parameter is set to true before any of the output parameters are rendered. It indicates whether there are any array items after the current array set.

nextStart
This parameter is set before any of the output parameters are rendered, and only if hasNext is true. It indicates the value of start that should be used to display the next array set.

nextEnd
This parameter is set before any of the output parameters are rendered, and only if hasNext is true. It indicates the (1-based) count of the last element in the next array set.

nextHowMany
This parameter is set before any of the output parameters are rendered, and only if hasNext is true. It indicates the number of elements in the next array set.

Open Parameters

output
This parameter is rendered once for each element in the subset of the results array defined by the start and howMany parameters.

outputStart
If the array is not empty, this parameter is rendered before any output elements. It can be used to render a heading, for instance.

outputEnd
If the array is not empty, this parameter is rendered after all output elements. It can be used to render a footer, for instance.

empty
This optional parameter is rendered if the array or the specified subset of the array contains no elements.

Example

This example displays 10 ski resorts, selected in the range from the 11th through the 20th items in the targeting result set. If there are fewer than 20 items, the example displays the 11th through the last items. For each resort, the JSP containing this servlet bean displays the name (in a hypertext link) and an image.

<%-- displays ski resorts 11-20 (1-indexed) of the result set--%>
<dsp:droplet name="/atg/targeting/TargetingRange">
  <dsp:param
bean="/atg/registry/repositorytargeters/targetedcontent/skiresorttargeter"
name="targeter"/>
  <dsp:param name="start" value="11"/>
  <dsp:param name="howMany" value="10"/>
  <dsp:oparam name="output">
    <dsp:getvalueof var="a11" param="element.URL"
    idtype="java.lang.String">
      <dsp:a href="${a11}">
        <dsp:valueof param="element.displayName"/>
      </dsp:a>
    </dsp:getvalueof>
    <dsp:getvalueof var="img18" param="element.image"
    Idtype="java.lang.String">
      <dsp:img src="${img18}"/>
    </dsp:getvalueof>
    <p>
  </dsp:oparam>
</dsp:droplet>
 
loading table of contents...