Looks up an item in one or more repositories based on the item’s ID, and renders the item on the page.

Class Name

atg.repository.servlet.ItemLookupDroplet

Component

/atg/dynamo/droplet/ItemLookupDroplet

Required Input Parameters

id

The ID of the item to look up.

repositoryKey

A key that maps to a secondary set of repositories.

Optional Input Parameters

repository

The repository to search.

Note: Use of this parameter is not recommended. Instead, you should define different instances of the ItemLookupDroplet for each set of repositories.

itemDescriptor

The name of the item descriptor to use to load the item.

Note: Use of this parameter is not recommended. Instead, you should specify the item descriptor in the itemDescriptor property of the servlet bean.

Output Parameters

element

Set to the RepositoryItem corresponding to the ID supplied.

error

Any exception that might occur while looking up the item.

Open Parameters

The following list describes the output and open parameters of the ItemLookupDroplet.

output

Rendered if the item is found in the repository.

empty

Rendered in all other cases, such as item not found, site visitor did not specify a required parameter.

Usage Notes

ItemLookupDroplet displays items in a repository. If your site uses more than one repository, you can create multiple instances of this servlet bean and configure each one differently. The repository and item descriptor type can be set through properties. If the useParams property is true, then the repository and item descriptor are resolved through input parameters. You can configure this servlet bean to define a mapping from a key to an alternate set of repositories.

For example, a ItemLookupDroplet servlet bean named ProductLookup might have the following properties:

$class=atg.repository.servlet.ItemLookupDroplet

 repository=/atg/commerce/catalog/ProductCatalog
 itemDescriptor=product

 alternateRepositories=\
      fr_FR=/atg/commerce/catalog/FrenchProductCatalog
      ja_JP=/atg/commerce/catalog/JapaneseProductCatalog
      de_DE=/atg/commerce/catalog/GermanProductCatalog

The servlet bean can then be invoked with the following parameters:

<dsp:droplet name="/atg/commerce/catalog/ProductLookup">
    <dsp:param name="id" param="productId"/>
    <dsp:param bean="/OriginatingRequest.requestLocale.localeString"
    name="repositoryKey"/>
    <dsp:setvalue param="product" paramvalue="element"
    <dsp:oparam name="output">
      <dsp:getvalueof var="a11" param="product.template.url"
      idtype="java.lang.String">
      <dsp:a href="${a11}">
         <dsp:param name="prod_id" param="product.repositoryId"/>
         <dsp:valueof param="product.displayName"/>
      </dsp:a>
      </dsp:getvalueof>
   </dsp:oparam>
</dsp:droplet>

If the mapping for the provided key is found, that repository is used. Otherwise, the system falls back to the default repository and searches for the item.

If the item cannot be found in the repository searched (such as the French product catalog), then the servlet again falls back to the default repository and tries to find the item with the same ID. This is only useful if the items have the exact same ID in each repository.

For example, you might view the site in French and try to look at product 1234. If the ID is defined in the French product catalog, you see the French version of that product. However, if 1234 is not defined, then you see the default English version of product 1234.

This behavior can be modified with use of the useDefaultRepository and getDefaultItem properties. If useDefaultRepository is false and an alternate repository cannot be found, then no repository is searched and empty is used. The same is true if an alternative repository is selected, but the item cannot be found and if getDefaultItem is false.

 
loading table of contents...