ClassName

atg.repository.servlet.ItemLookupDroplet

Component

/atg/dynamo/droplet/ItemLookupDroplet

The ItemLookupDroplet servlet bean 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, you might have an ItemLookupDroplet servlet bean named ProductLookup, and give it 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.

Input Parameters

The following list describes the input parameters of the ItemLookupDroplet.

id
The ID of the item to lookup.

repositoryKey
This optional parameter is used as a key to map to a secondary set of repositories.

repository
This optional parameter specified repository to search for the item. (Note: Use of this parameter is not recommended. A preferable approach is to define different instances of the ItemLookupDroplet for each set of repositories.)

itemDescriptor
This optional parameter sets the name of the item descriptor to use to load the item. (Note: Use of this parameter is not recommended. A better approach is to specify the item descriptor through the itemDescriptor property of the servlet bean.)

Output Parameter

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.

 
loading table of contents...