Performs a targeting operation and displays a subset of the items returned by the targeter, specified as a range.
Class Name |
|
---|---|
Component |
|
Required 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
.
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. (By default, the value of this property is /atg/targeting/TargetingSourceMap
.)
howMany
The number of array elements to display. If howMany
is greater than the number of array elements, TargetingRange renders the number of elements available.
start
The initial array element, where a setting of 1 (the default) specifies the array’s first element. If start
is greater than the number of elements in the array, the empty
parameter (if specified) is rendered.
sortProperties
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 targeter sorting and servlet bean sorting.
fireViewItemEvent
Specifies whether to trigger a JMS view item event when a page is accessed. The default is true. To prevent the ATG platform from firing a view item event, set this parameter to false.
fireContentEvent
Specifies whether to trigger an event when a page is accessed. If set to true or omitted, a JMS view event fires; if the accessed page is a Content repository item, a content viewed event also fires. To prevent the ATG platform from firing these two events, set this parameter to false.
Note: Instead of this parameter, use the fireViewItemEvent
parameter.
fireContentTypeEvent
Specifies whether to trigger an event when a page is accessed. If set to true or omitted, a JMS view event fires; if the accessed page is a Content repository item, a content type event also fires. To prevent the ATG platform from firing these two events, set this parameter to false.
Note: Instead of this parameter, use the fireViewItemEvent
parameter.
Output Parameters
index
Set to the zero-based index of the current array element 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
Set to the one-based index of the current array element 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
Set to the current array element each time the index
increments and the output
parameter is rendered.
hasPrev
Set to true before any output parameters are rendered, indicates whether there are any array items before the current array set.
prevStart
Set before any output parameters are rendered, and only if hasPrev
is true, indicates the value of start that should be used to display the previous array set.
prevEnd
Set before any output parameters are rendered, and only if hasPrev
is true, indicates the (one-based) count of the last element in the previous array set.
prevHowMany
Set before any output parameters are rendered, and only if hasPrev
is true, indicates the number of elements in the previous array set.
hasNext
Set to true before any output parameters are rendered, indicates whether there are any array items after the current array set.
nextStart
Set before any output parameters are rendered, and only if hasNext
is true, indicates the value of start that should be used to display the next array set.
nextEnd
Set before any output parameters are rendered, and only if hasNext
is true, indicates the (one-based) count of the last element in the next array set.
nextHowMany
Set before any output parameters are rendered, and only if hasNext
is true, indicates the number of elements in the next array set.
Open Parameters
output
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, rendered before any output elements. For example, this parameter can be used to render a heading.
outputEnd
If the array is not empty, rendered after all output elements. For example, this parameter can be used to render a footer.
empty
Rendered if the array or the specified subset of the array contains no elements
.
Usage Notes
TargetingRange 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 targeter component used for the targeting operation is set by the targeter
and sourceMap
input parameters.
TargetingRange 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
Example
The following example displays 10 ski resorts, selected in the range from items 11 through 20 in the targeting result set. If there are fewer than 20 items, the example displays items 11 through last. 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>