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:
<dsp:page>
<%--
Generate a cross site URL and set in request scope parameter 'siteLinkUrl' so
it's accessible to the calling JSP
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"/>
<c:choose>
<%-- 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:param name="currentSiteFirst" value="true"/>
<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"/>
</dsp:oparam>
</dsp:droplet>
</dsp:oparam>
</dsp:droplet>
</c:when>
<%-- Site ID supplied --%>
<c:otherwise>
<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"/>
</dsp:oparam>
</dsp:droplet>
</c:otherwise>
</c:choose>
</dsp:page>
