Obtains a site ID from a RepositoryItem.

Class Name




Required Input Parameters


The RepositoryItem to evaluate for sites. By default, this servlet bean queries the item’s siteIds property. You can specify a different property to query by setting the servlet bean property sitesPropertyName.

Optional Input Parameters


If true, includes inactive sites among the sites that SiteIdForItem can return. Set this parameter and includeDisabledSites to true in order to allow return of a site that is both inactive and disabled.

By default, only active sites are returned.


If true, includes disabled sites among the sites that SiteIdForItem can return. To include disabled sites, includeInactiveSites must also be set to true.

By default, only enabled sites are returned.


If true (the default value), gives precedence to the current site.


Specifies a site to have precedence, if it is among the site IDs set in the item-specified RepositoryItem.


The ID of a ShareableType that is registered with the SiteGroupManager. This parameter specifies to give precedence to sites within a site group that share a Nucleus component of this ShareableType, over sites that are outside the group.

Output Parameters


The site ID returned by this servlet bean.


Set to true if the returned site ID is not of the current site.


Set to true if the returned site ID is for an active site.


Set to true if the returned site ID is for an enabled site.


Set if this servlet bean cannot return a site ID, or another error occurs.


Set to true if the returned site belongs to a shareableTypeId-specified sharing group that includes the current site.

Note: If shareableTypeId is null, inGroup always returns true. Because no sharing group is specified, all sites are eligible for selection, subject to other input parameter settings.

Usage Notes

SiteIdForItem returns a site ID from the list of site IDs that are stored in the specified RepositoryItem’s siteIds property. For example, you might define cross-sell and upsell lists that include items that belong to multiple sites. When a user selects an item, SiteIdForItem can be invoked in order to determine the best site ID to return for the selected item.

Site Selection Algorithm

You can modify SiteIdForItem’s site selection algorithm by setting one or more input parameters. By default, SiteIdForItem only returns an enabled and active site. If desired, you can allow return of a site that is inactive and enabled by setting the input parameters includeInactiveSites to true. You can also allow return of a site that is both inactive and disabled by setting the input parameters includeInactiveSites and includeDisabledSites to true. By default, both input parameters are set to false.

Among all sites that are eligible to be returned, SiteIdForItem determines its selection by prioritizing the sites as follows:

A site’s configured priority can affect its precedence in the SiteIdForItem selection process. For more information, see Site Priority and Precedence.


By default, SiteIdForItem assumes that repository items store site IDs in the their siteIds property. If a repository item uses a different property to store site IDs, you can use SiteIdForItem to obtain site IDs from that property by setting its name in the servlet bean’s sitesPropertyName property.

SiteIdForItem versus SiteIdForCatalogItem

SiteIdForItem and the ATG Commerce servlet bean SiteIdForCatalogItem (Nucleus component /atg/commerce/multisite/SiteIdForCatalogItem/)use the same class, atg.droplet.multisite.SiteIdForItemDroplet. As installed, they are almost identical, differing in only one respect: SiteIdForCatalogItem sets its shareableTypeId property to atg.ShoppingCart. SiteIdForItem can achieve the same results if its ShareableTypeId input parameter is set to atg.ShoppingCart.


The following example shows how you might use SiteIdForItem with SiteLinkDroplet to identify a product’s site ID, then generate an absolute URL to the product on that site. The generated URL is used to set a request-scope variable that other JSPs can access:

  Generate a cross site URL and set in request scope parameter 'siteLinkUrl'

  Expected page parameters:
    product - product item
    siteId -  the site to use in generated URL; if not supplied, use SiteIdForItem
              to obtain the site ID from the product item.
  <dsp:importbean bean="/atg/dynamo/droplet/multisite/SiteLinkDroplet"/>
  <dsp:importbean bean="/atg/commerce/multisite/SiteIdForItem"/>

  <dsp:getvalueof var="product" param="product"/>
  <dsp:getvalueof var="siteId" param="siteId"/>


    <%-- No site ID supplied, so get one from SiteIdForItem --%>
    <c:when test="${empty siteId}">
      <dsp:droplet name="SiteIdForItem">
        <dsp:param name="item" param="product"/>
        <dsp:param name="shareableTypeId" value="atg.ShoppingCart"/>
        <dsp:oparam name="output">
          <dsp:getvalueof var="productSiteId" param="siteId"/>

          <dsp:droplet name="SiteLinkDroplet">
             <dsp:param name="siteId" value="${productSiteId}"/>
             <dsp:param name="path" param="product.template.url"/>
             <dsp:oparam name="output">
               <dsp:getvalueof var="siteLinkUrl" scope="request" param="url"/>

    <%-- Site ID supplied --%>
      <dsp:droplet name="SiteLinkDroplet">
        <dsp:param name="siteId" value="${siteId}"/>
        <dsp:param name="path" param="product.template.url"/>
        <dsp:oparam name="output">
          <dsp:getvalueof var="siteLinkUrl" scope="request" param="url"/>