After you’ve set up your Rule Set Service, targeter component, and optionally a TargetingSourceMap
service, you can use the Personalization module’s targeting servlet beans to access the targeter service from a content page (.jhtml
or .jsp
file). Targeting servlet beans are described in the Serving Targeted Content with ATG Servlet Beans chapter of the Page Developer's Guide.
The atg.targeting
package includes a class, atg.targeting.TargetingResults
, that you can use to perform targeting operations outside the context of a targeting servlet bean on a content page. TargetingResults
is useful in cases where you have a potentially large number of results. TargetingResults
is a Nucleus service that can be configured with the specific Targeter
and NameResolver
, and used to produce the corresponding TargetingEnumeration
objects.
A TargetingResults
component uses the following properties:
Property | Value |
---|---|
| A targeter that operates over the appropriate repository. |
| A |
| Number of items to target for in each iteration. If 0, only one targeting operation will be performed, with all the targeting results returned at once. Otherwise, targeting will be performed in chunks, with the specified number of elements returned each time. |
The targeter
property should point to a targeter service that operates over a repository. You can configure the targeter service through the Targeting and Segmentation interface in the Business Control Center (see the Business Control Center User's Guide), you can use the Targeting > Content Targeters window of the ACC (see the Personalization Guide for Business Users), or you can configure the targeter by hand (see Creating Rules for Targeting Content in this manual).
The bufferSize
property lets you limit the maximum number of items that are returned at a time. The read-only results
property is used to extract the results as an Enumeration. When the Enumeration elements are accessed, targeting is performed as needed to extract the next result array of size bufferSize
. If bufferSize
is 0, the entire targeting result array is obtained the first time an Enumeration element is asked for. Thus, if the number of items in the targeting results is potentially large, this allows you to split one expensive targeting operation into many inexpensive ones. This is especially useful if, for example, you are only interested in the first 10 elements in the result set.
The TargetingResults.getResults()
method returns an Enumeration that is an instance of atg.targeting.TargetingEnumeration
. TargetingEnumeration
is simply an implementation of Enumeration
that is created with, at a minimum, a Targeter
and a NameResolver
, and allows you to access targeting results with Enumeration
methods.